From 3dbc7347ecae8232287a213165831c3609a1d435 Mon Sep 17 00:00:00 2001 From: Dmitry Tantsur Date: Tue, 16 Nov 2021 10:09:13 +0000 Subject: [PATCH] Revert "Explicitly trap on ERR" and fix exit code hanlding Trapping on ERR does not do what is implied here and is redundant when trapping on EXIT is used together with `set -e`. The real problem is that in the CI scripts we pipe test-bifrost.sh into tee with a log file without setting -o pipefail in bash. This change fixes it. This reverts commit b31bc66726ddcff11678a77cce8b14f629a1b19d. Change-Id: Ifca4049f5967c0b2153ecffb4c153a96b4a62cc7 --- playbooks/ci/run.yaml | 5 ++++- scripts/collect-test-info.sh | 3 ++- scripts/test-bifrost.sh | 1 - 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/playbooks/ci/run.yaml b/playbooks/ci/run.yaml index 76ddd2655..4cbe08664 100644 --- a/playbooks/ci/run.yaml +++ b/playbooks/ci/run.yaml @@ -1,8 +1,11 @@ - hosts: all tasks: - shell: - cmd: bash scripts/test-bifrost.sh 2>&1 | tee "{{ ansible_user_dir }}/bifrost.log" + cmd: | + set -eo pipefail + ./scripts/test-bifrost.sh 2>&1 | tee "{{ ansible_user_dir }}/bifrost.log" chdir: "{{ ansible_user_dir }}/{{ zuul.projects['opendev.org/openstack/bifrost'].src_dir }}" + executable: /bin/bash environment: BIFROST_TRACE: "true" BUILD_IMAGE: "{{ build_image | default(false) | bool | lower }}" diff --git a/scripts/collect-test-info.sh b/scripts/collect-test-info.sh index eaff4998c..5785e0be0 100755 --- a/scripts/collect-test-info.sh +++ b/scripts/collect-test-info.sh @@ -83,7 +83,8 @@ sudo journalctl -u uwsgi@keystone-admin &> ${LOG_LOCATION}/keystone-admin.log # Copy PXE information mkdir -p ${LOG_LOCATION}/pxe/ -cp /httpboot/ipxe.* ${LOG_LOCATION}/pxe/ +ls -lR /httpboot > ${LOG_LOCATION}/pxe/listing.txt +cp -aL /httpboot/*.ipxe ${LOG_LOCATION}/pxe/ cp -aL /httpboot/pxelinux.cfg/ ${LOG_LOCATION}/pxe/ # Copy baremetal information diff --git a/scripts/test-bifrost.sh b/scripts/test-bifrost.sh index 77c48611a..648380f5c 100755 --- a/scripts/test-bifrost.sh +++ b/scripts/test-bifrost.sh @@ -139,7 +139,6 @@ on_exit() { $SCRIPT_HOME/collect-test-info.sh } trap on_exit EXIT -trap on_exit ERR # Change working directory cd $BIFROST_HOME/playbooks