From 00f6d27561381c729c7f5c5867a677add57aa5db Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Thu, 12 Jan 2023 15:50:48 +1100 Subject: [PATCH] infra-prod: save run logs even if being published If infra_prod_playbook_collect_log is set, then we copy and publish the playbook log in the job results. Currently we skip renaming the log file on bridge in this case, meaning that we don't keep logs of old runs on bridge. Also, there is a bug in the bit that resets the timestamp on the logfile (so it is timestamped by the time it started, no ended) that it isn't checking this flag, so we end up with a bunch of zero-length files in this case. I guess the thinking here was that since the log is published, there's no need to keep it on bridge as well. The abstract case here is really only instantiated for manage-projects, which is the only job we publish the log for. Today we wanted an older log, but it had already been purged from object storage. It seems worth keeping this on-disk as well as publishing it. Remove the checks around the rename/cleanup. This will also fix the bug of zero-sized files being created, because the renamed file will be there now. Change-Id: Ic5ab52797fef880ae3ec3d92c071ef802e63b778 --- playbooks/zuul/run-production-playbook-post.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/playbooks/zuul/run-production-playbook-post.yaml b/playbooks/zuul/run-production-playbook-post.yaml index dbf0fa1d5f..4c563784ad 100644 --- a/playbooks/zuul/run-production-playbook-post.yaml +++ b/playbooks/zuul/run-production-playbook-post.yaml @@ -85,7 +85,6 @@ _log_timestamp: '{{ _log_timestamp.stdout | trim }}' - name: Rename playbook log on bridge - when: not infra_prod_playbook_collect_log become: yes copy: remote_src: yes @@ -105,7 +104,6 @@ become: yes - name: Cleanup old playbook logs on bridge - when: not infra_prod_playbook_collect_log become: yes shell: | find /var/log/ansible -name '{{ playbook_name }}.log.*' -type f -mtime +30 -delete