Collect logs in post when not collected in run phase

Noticed in https://review.opendev.org/780856 when
job times out logs are not collected.
Collected logs can be helpful for debugging the issue
for which job timed out.

Change-Id: I315447073294896b1af6b94db917a11a9dfee506
This commit is contained in:
yatinkarel 2021-03-17 15:54:54 +05:30
parent 0fee3ad167
commit e6f762f780
2 changed files with 15 additions and 1 deletions

12
playbooks/copy-logs.yaml Normal file
View File

@ -0,0 +1,12 @@
- hosts: all
tasks:
- name: Collect logs if not already collected
shell:
cmd: |
set -ex
if [[ ! -d "${WORKSPACE}/logs/etc" ]]; then
./copy_logs.sh
fi
executable: /bin/bash
chdir: '{{ ansible_user_dir }}/workspace/puppet-openstack-integration'
environment: '{{ zuul | zuul_legacy_vars }}'

View File

@ -55,7 +55,9 @@
abstract: true
pre-run: playbooks/prepare-node-integration.yaml
run: playbooks/run-integration-tests.yaml
post-run: playbooks/upload-logs.yaml
post-run:
- playbooks/copy-logs.yaml
- playbooks/upload-logs.yaml
timeout: 7200
irrelevant-files:
- ^.*\.md$