diff --git a/scriptworker/cot/verify.py b/scriptworker/cot/verify.py index def93c00..43587daa 100644 --- a/scriptworker/cot/verify.py +++ b/scriptworker/cot/verify.py @@ -2192,7 +2192,7 @@ async def verify_chain_of_trust(chain): 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, path=log_path, log_obj=scriptworker_log, diff --git a/scriptworker/log.py b/scriptworker/log.py index 07244a8d..4b456386 100644 --- a/scriptworker/log.py +++ b/scriptworker/log.py @@ -112,7 +112,7 @@ def get_log_filehandle(context): """ 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/scriptworker/test/test_integration.py b/scriptworker/test/test_integration.py index e8a28de7..8e4f7ae5 100644 --- a/scriptworker/test/test_integration.py +++ b/scriptworker/test/test_integration.py @@ -272,11 +272,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)) @@ -289,17 +286,12 @@ async def test_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) @@ -307,10 +299,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.skipif(os.environ.get("NO_TESTS_OVER_WIRE"), reason=SKIP_REASON) diff --git a/scriptworker/test/test_worker.py b/scriptworker/test/test_worker.py index 437b13f5..21cd7323 100644 --- a/scriptworker/test/test_worker.py +++ b/scriptworker/test/test_worker.py @@ -405,7 +405,7 @@ async def test_run_tasks_cancel_cot(context, mocker): mock_prepare_task.assert_called_once() mock_complete_task.assert_called_once_with(mock.ANY, STATUSES['worker-shutdown']) - mock_do_upload.assert_called_once_with(context, ['public/logs/chain_of_trust.log', 'public/logs/live_backing.log']) + mock_do_upload.assert_called_once_with(context, ['public/logs/live_backing.log']) @pytest.mark.asyncio @@ -445,7 +445,7 @@ async def mock_run_task(_, to_cancellable_process): assert task_process.stopped_due_to_worker_shutdown mock_prepare_task.assert_called_once() mock_complete_task.assert_called_once_with(mock.ANY, STATUSES['worker-shutdown']) - mock_do_upload.assert_called_once_with(context, ['public/logs/chain_of_trust.log', 'public/logs/live_backing.log']) + mock_do_upload.assert_called_once_with(context, ['public/logs/live_backing.log']) @pytest.mark.asyncio @@ -527,7 +527,7 @@ async def mock_do_run_task(_, __, to_cancellable_process): mock_prepare_task.assert_called_once() mock_complete_task.assert_called_once_with(mock.ANY, STATUSES['worker-shutdown']) - mock_do_upload.assert_called_once_with(context, ['public/logs/chain_of_trust.log', 'public/logs/live_backing.log']) + mock_do_upload.assert_called_once_with(context, ['public/logs/live_backing.log']) @pytest.mark.asyncio diff --git a/scriptworker/worker.py b/scriptworker/worker.py index 296b22a8..cfc4e586 100644 --- a/scriptworker/worker.py +++ b/scriptworker/worker.py @@ -137,7 +137,7 @@ async def invoke(self, context): 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']] + 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']