From ad8ebb927bb660a48d988d11fd5d210703e80b5a Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Tue, 23 Jul 2024 14:30:26 -0700 Subject: [PATCH] Update cleanups for base and base-minimal This is the followup to the parent change that makes the same cleanup modifications to base and base-minimal jobs. The justification is the same: fix a deprecation warning and improve logging and reliability of the cleanup run. We have split things up to enable testing to ensure we don't accidentally break the world due to changing the base job. Change-Id: I6589c185f6071932c6955223ffcbed8d3490fed6 --- playbooks/base-minimal/cleanup.yaml | 20 +++++--------------- playbooks/base-minimal/post.yaml | 24 ++++++++++++++++++------ playbooks/base/cleanup.yaml | 20 +++++--------------- playbooks/base/post.yaml | 24 ++++++++++++++++++------ zuul.d/jobs.yaml | 6 ++++-- 5 files changed, 50 insertions(+), 44 deletions(-) diff --git a/playbooks/base-minimal/cleanup.yaml b/playbooks/base-minimal/cleanup.yaml index 2aea1ce..02a3385 100644 --- a/playbooks/base-minimal/cleanup.yaml +++ b/playbooks/base-minimal/cleanup.yaml @@ -1,16 +1,6 @@ - hosts: all - tasks: - - name: Gather debug info on job fail - when: not (zuul_success | bool) - block: - - name: get df disk usage - raw: timeout -k 5 90 df - - - name: get df inode usage - raw: timeout -k 5 90 df -i - - - name: get l2 networking - raw: timeout -k 5 90 ip link - - - name: get l3 networking - raw: timeout -k 5 90 ip addr + # NOTE(pabelanger): We ignore_errors for the following tasks as not to fail + # successful jobs. + ignore_errors: yes + roles: + - remove-build-sshkey diff --git a/playbooks/base-minimal/post.yaml b/playbooks/base-minimal/post.yaml index c4a139d..a4a7408 100644 --- a/playbooks/base-minimal/post.yaml +++ b/playbooks/base-minimal/post.yaml @@ -2,10 +2,22 @@ roles: - fetch-output - merge-output-to-logs + tasks: + - name: Gather debug info on job fail + when: not (zuul_success | bool) + block: + - name: get df disk usage + raw: timeout -k 5 90 df + failed_when: false -- hosts: all - # NOTE(pabelanger): We ignore_errors for the following tasks as not to fail - # successful jobs. - ignore_errors: yes - roles: - - remove-build-sshkey + - name: get df inode usage + raw: timeout -k 5 90 df -i + failed_when: false + + - name: get l2 networking + raw: timeout -k 5 90 ip link + failed_when: false + + - name: get l3 networking + raw: timeout -k 5 90 ip addr + failed_when: false diff --git a/playbooks/base/cleanup.yaml b/playbooks/base/cleanup.yaml index 2aea1ce..02a3385 100644 --- a/playbooks/base/cleanup.yaml +++ b/playbooks/base/cleanup.yaml @@ -1,16 +1,6 @@ - hosts: all - tasks: - - name: Gather debug info on job fail - when: not (zuul_success | bool) - block: - - name: get df disk usage - raw: timeout -k 5 90 df - - - name: get df inode usage - raw: timeout -k 5 90 df -i - - - name: get l2 networking - raw: timeout -k 5 90 ip link - - - name: get l3 networking - raw: timeout -k 5 90 ip addr + # NOTE(pabelanger): We ignore_errors for the following tasks as not to fail + # successful jobs. + ignore_errors: yes + roles: + - remove-build-sshkey diff --git a/playbooks/base/post.yaml b/playbooks/base/post.yaml index c4a139d..a4a7408 100644 --- a/playbooks/base/post.yaml +++ b/playbooks/base/post.yaml @@ -2,10 +2,22 @@ roles: - fetch-output - merge-output-to-logs + tasks: + - name: Gather debug info on job fail + when: not (zuul_success | bool) + block: + - name: get df disk usage + raw: timeout -k 5 90 df + failed_when: false -- hosts: all - # NOTE(pabelanger): We ignore_errors for the following tasks as not to fail - # successful jobs. - ignore_errors: yes - roles: - - remove-build-sshkey + - name: get df inode usage + raw: timeout -k 5 90 df -i + failed_when: false + + - name: get l2 networking + raw: timeout -k 5 90 ip link + failed_when: false + + - name: get l3 networking + raw: timeout -k 5 90 ip addr + failed_when: false diff --git a/zuul.d/jobs.yaml b/zuul.d/jobs.yaml index ffa4ed2..ba56228 100644 --- a/zuul.d/jobs.yaml +++ b/zuul.d/jobs.yaml @@ -52,8 +52,9 @@ pre-run: playbooks/base/pre.yaml post-run: - playbooks/base/post.yaml + - name: playbooks/base/cleanup.yaml + cleanup: true - playbooks/base/post-logs.yaml - cleanup-run: playbooks/base/cleanup.yaml roles: - zuul: zuul/zuul-jobs timeout: 1800 @@ -106,8 +107,9 @@ pre-run: playbooks/base-minimal/pre.yaml post-run: - playbooks/base-minimal/post.yaml + - name: playbooks/base-minimal/cleanup.yaml + cleanup: true - playbooks/base-minimal/post-logs.yaml - cleanup-run: playbooks/base-minimal/cleanup.yaml roles: - zuul: zuul/zuul-jobs timeout: 1800