diff --git a/src/scriptworker/cot/verify.py b/src/scriptworker/cot/verify.py index ec8acd58..2562b202 100644 --- a/src/scriptworker/cot/verify.py +++ b/src/scriptworker/cot/verify.py @@ -1274,9 +1274,6 @@ async def populate_jsone_context(chain, parent_link, decision_link, tasks_for): 'Unknown cot_product_type "{}" for cot_product "{}"!'.format(chain.context.config["cot_product_type"], chain.context.config["cot_product"]) ) - log.debug("{} json-e context:".format(parent_link.name)) - # format_json() breaks on lambda values; use pprint.pformat here. - log.debug(pprint.pformat(jsone_context)) return jsone_context @@ -1820,7 +1817,6 @@ def get_source_url(obj): """ source_env_prefix = obj.context.config["source_env_prefix"] task = obj.task - log.debug("Getting source url for {} {}...".format(obj.name, obj.task_id)) repo = get_repo(obj.task, source_env_prefix=source_env_prefix) source = task["metadata"]["source"] if repo and not verify_repo_matches_url(repo, source): @@ -1912,7 +1908,7 @@ async def verify_chain_of_trust(chain, *, check_task=False): CoTError: on failure """ - log_path = os.path.join(chain.context.config["task_log_dir"], "chain_of_trust.log") + log_path = os.path.join(chain.context.config["task_log_dir"], "live_backing.log") scriptworker_log = logging.getLogger("scriptworker") with contextual_log_handler( chain.context, @@ -1944,7 +1940,7 @@ async def verify_chain_of_trust(chain, *, check_task=False): raise else: raise CoTError(str(exc)) - log.info("Good.") + log.info("taskId %s passes chain of trust verification.", chain.task_id) # verify_cot_cmdln {{{1 @@ -1970,10 +1966,6 @@ async def _async_verify_cot_cmdln(opts, tmp): context.config["github_oauth_token"] = os.environ.get("SCRIPTWORKER_GITHUB_OAUTH_TOKEN") cot = ChainOfTrust(context, opts.task_type, task_id=opts.task_id) await verify_chain_of_trust(cot, check_task=True) - log.info(format_json(cot.dependent_task_ids())) - log.info("{} : {}".format(cot.name, cot.task_id)) - for link in cot.links: - log.info("{} : {}".format(link.name, link.task_id)) def verify_cot_cmdln(args=None, event_loop=None): diff --git a/src/scriptworker/log.py b/src/scriptworker/log.py index f8b7e86d..08302185 100644 --- a/src/scriptworker/log.py +++ b/src/scriptworker/log.py @@ -113,7 +113,7 @@ def get_log_filehandle(context: Any) -> Iterator[IO[str]]: """ log_file_name = get_log_filename(context) makedirs(context.config["task_log_dir"]) - with open(log_file_name, "w", encoding="utf-8") as filehandle: + with open(log_file_name, "a", encoding="utf-8") as filehandle: yield filehandle diff --git a/src/scriptworker/utils.py b/src/scriptworker/utils.py index 2d5dffc6..01ebb212 100644 --- a/src/scriptworker/utils.py +++ b/src/scriptworker/utils.py @@ -666,7 +666,6 @@ async def download_file(context, url, abs_filename, session=None, chunk_size=128 if not chunk: break fd.write(chunk) - log.info("Done") # get_loggable_url {{{1 diff --git a/src/scriptworker/worker.py b/src/scriptworker/worker.py index 8f15bf19..bba86806 100644 --- a/src/scriptworker/worker.py +++ b/src/scriptworker/worker.py @@ -136,7 +136,7 @@ async def invoke(self, context): status = await do_run_task(context, self._run_cancellable, self._to_cancellable_process) artifacts_paths = filepaths_in_dir(context.config["artifact_dir"]) except WorkerShutdownDuringTask: - shutdown_artifact_paths = [os.path.join("public", "logs", log_file) for log_file in ["chain_of_trust.log", "live_backing.log"]] + shutdown_artifact_paths = [os.path.join("public", "logs", log_file) for log_file in ["live_backing.log"]] artifacts_paths = [path for path in shutdown_artifact_paths if os.path.isfile(os.path.join(context.config["artifact_dir"], path))] status = STATUSES["worker-shutdown"] status = worst_level(status, await do_upload(context, artifacts_paths)) diff --git a/tests/test_integration.py b/tests/test_integration.py index 825ef951..c2d12494 100644 --- a/tests/test_integration.py +++ b/tests/test_integration.py @@ -262,11 +262,8 @@ async def test_shutdown(): async with get_context(partial_config) as context: result = await create_task(context, task_id, task_id) assert result["status"]["state"] == "pending" - fake_cot_log = os.path.join(context.config["artifact_dir"], "public", "logs", "chain_of_trust.log") fake_other_artifact = os.path.join(context.config["artifact_dir"], "public", "artifact.apk") - with open(fake_cot_log, "w") as file: - file.write("CoT logs") with open(fake_other_artifact, "w") as file: file.write("unrelated artifact") cancel_fut = asyncio.ensure_future(do_shutdown(context)) @@ -277,13 +274,10 @@ async def test_shutdown(): assert status["status"]["runs"][0]["state"] == "exception" assert status["status"]["runs"][0]["reasonResolved"] == "worker-shutdown" log_url = context.queue.buildUrl("getArtifact", task_id, 0, "public/logs/live_backing.log") - cot_log_url = context.queue.buildUrl("getArtifact", task_id, 0, "public/logs/chain_of_trust.log") other_artifact_url = context.queue.buildUrl("getArtifact", task_id, 0, "public/artifact.apk") log_path = os.path.join(context.config["work_dir"], "log") - cot_log_path = os.path.join(context.config["work_dir"], "cot_log") other_artifact_path = os.path.join(context.config["work_dir"], "artifact.apk") await utils.download_file(context, log_url, log_path) - await utils.download_file(context, cot_log_url, cot_log_path) with pytest.raises(Download404): await utils.download_file(context, other_artifact_url, other_artifact_path) @@ -291,10 +285,6 @@ async def test_shutdown(): contents = fh.read() assert contents.rstrip() == "running task script\nAutomation Error: python exited with signal -15" - with open(cot_log_path) as fh: - contents = fh.read() - assert contents.rstrip() == "CoT logs" - # empty_queue {{{1 @pytest.mark.parametrize("context_function", [get_context, get_temp_creds_context])