test: add prominent message in test script cleanup functions
When a test script fails in CI, it's often difficult to pinpoint the exact line in the log where the script failed and the cleanup() function (trapped on EXIT) begins. Adding a prominent line (with greenprint where available) at the start of the cleanup function will make reading logs of failed jobs a lot easier.
This commit is contained in:
parent
3667766661
commit
cd49c932a2
11 changed files with 12 additions and 2 deletions
|
|
@ -323,6 +323,7 @@ function dump_db() {
|
|||
WORKDIR=$(mktemp -d)
|
||||
KILL_PIDS=()
|
||||
function cleanup() {
|
||||
greenprint "== Script execution stopped or finished - Cleaning up =="
|
||||
set +eu
|
||||
case $CLOUD_PROVIDER in
|
||||
"$CLOUD_PROVIDER_AWS")
|
||||
|
|
@ -1188,7 +1189,7 @@ function verifyDisk() {
|
|||
|
||||
infofile="${filename}-info.json"
|
||||
sudo /usr/libexec/osbuild-composer-test/image-info "${filename}" | tee "${infofile}" > /dev/null
|
||||
|
||||
|
||||
# save image info to artifacts
|
||||
cp -v "${infofile}" "${ARTIFACTS}/image-info.json"
|
||||
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ fi
|
|||
|
||||
TEMPDIR=$(mktemp -d)
|
||||
function cleanup() {
|
||||
greenprint "== Script execution stopped or finished - Cleaning up =="
|
||||
sudo rm -rf "$TEMPDIR"
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ fi
|
|||
|
||||
TEMPDIR=$(mktemp -d)
|
||||
function cleanup() {
|
||||
echo "== Script execution stopped or finished - Cleaning up =="
|
||||
sudo rm -rf "$TEMPDIR"
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ fi
|
|||
|
||||
TEMPDIR=$(mktemp -d)
|
||||
function cleanup() {
|
||||
greenprint "== Script execution stopped or finished - Cleaning up =="
|
||||
sudo rm -rf "$TEMPDIR"
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ function cleanupGCP() {
|
|||
|
||||
TEMPDIR=$(mktemp -d)
|
||||
function cleanup() {
|
||||
greenprint "🧼 Cleaning up"
|
||||
greenprint "== Script execution stopped or finished - Cleaning up =="
|
||||
cleanupGCP
|
||||
sudo rm -rf "$TEMPDIR"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ fi
|
|||
|
||||
TEMPDIR=$(mktemp -d)
|
||||
function cleanup() {
|
||||
echo "== Script execution stopped or finished - Cleaning up =="
|
||||
sudo rm -rf "$TEMPDIR"
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ function greenprint {
|
|||
greenprint "Registering clean ups"
|
||||
KILL_PIDS=()
|
||||
function cleanup() {
|
||||
greenprint "== Script execution stopped or finished - Cleaning up =="
|
||||
set +eu
|
||||
greenprint "Stopping containers"
|
||||
sudo /usr/libexec/osbuild-composer-test/run-koji-container.sh stop
|
||||
|
|
|
|||
|
|
@ -110,6 +110,7 @@ case "${ID}" in
|
|||
esac
|
||||
|
||||
function cleanup {
|
||||
greenprint "== Script execution stopped or finished - Cleaning up =="
|
||||
# Make the cleanup function best effort
|
||||
set +eu
|
||||
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ function generate_certificates {
|
|||
}
|
||||
|
||||
function cleanup {
|
||||
greenprint "== Script execution stopped or finished - Cleaning up =="
|
||||
# Make the cleanup function best effort
|
||||
set +eu
|
||||
|
||||
|
|
|
|||
|
|
@ -167,6 +167,7 @@ function cleanupAWSS3() {
|
|||
WORKDIR=$(mktemp -d)
|
||||
KILL_PIDS=()
|
||||
function cleanup() {
|
||||
greenprint "== Script execution stopped or finished - Cleaning up =="
|
||||
set +eu
|
||||
cleanupAWSS3
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ set -euxo pipefail
|
|||
|
||||
WORKSPACE=$(mktemp -d)
|
||||
function cleanup() {
|
||||
echo "== Script execution stopped or finished - Cleaning up =="
|
||||
rm -rf "$WORKSPACE"
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue