Merge clean_up() into cleanup_on_exit() for filesystem.sh
This commit is contained in:
parent
2a8bd4ce9b
commit
ede798ae6c
1 changed files with 9 additions and 11 deletions
|
|
@ -22,9 +22,17 @@ COMPOSE_START=${TEMPDIR}/compose-start-${IMAGE_KEY}.json
|
|||
COMPOSE_INFO=${TEMPDIR}/compose-info-${IMAGE_KEY}.json
|
||||
|
||||
function cleanup_on_exit() {
|
||||
greenprint "== Script execution stopped or finished - Cleaning up =="
|
||||
greenprint "🧼 Cleaning up"
|
||||
# kill dangling journalctl processes to prevent GitLab CI from hanging
|
||||
sudo pkill journalctl || echo "Nothing killed"
|
||||
|
||||
# since this function can be called at any time, ensure that we don't expand unbound variables
|
||||
IMAGE_FILENAME="${IMAGE_FILENAME:-}"
|
||||
[ "$IMAGE_FILENAME" ] && sudo rm -f "$IMAGE_FILENAME"
|
||||
|
||||
# Remove tmp dir.
|
||||
sudo rm -rf "$TEMPDIR"
|
||||
|
||||
}
|
||||
trap cleanup_on_exit EXIT
|
||||
|
||||
|
|
@ -94,14 +102,6 @@ build_image() {
|
|||
fi
|
||||
}
|
||||
|
||||
# Clean up our mess.
|
||||
clean_up () {
|
||||
greenprint "🧼 Cleaning up"
|
||||
# Remove "remote" repo.
|
||||
sudo rm -f "$IMAGE_FILENAME"
|
||||
# Remove tmp dir.
|
||||
sudo rm -rf "$TEMPDIR"
|
||||
}
|
||||
check_result () {
|
||||
if [ ${#FAILED_MOUNTPOINTS[@]} -eq 0 ]; then
|
||||
greenprint "🎉 $1 scenario went as expected"
|
||||
|
|
@ -340,7 +340,5 @@ check_result "Failing"
|
|||
greenprint "🧼 Clean up osbuild-composer again"
|
||||
sudo composer-cli blueprints delete custom-filesystem-fail > /dev/null
|
||||
|
||||
clean_up
|
||||
|
||||
greenprint "🎉 All tests passed."
|
||||
exit 0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue