fix(ci): only report a kept build volume when one actually exists
A failure BEFORE any container ran - a bad leg name, a preflight abort - never creates the run's volume, but the cleanup trap still printed 'kept <volume> for post-mortem' and an inspect command for something that does not exist. Check first; stay silent when there is nothing to keep. Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
This commit is contained in:
@@ -85,6 +85,11 @@ ci_cleanup() {
|
||||
if [ "${CBM_CI_BUILD_VOLUME}" = "cbm-build" ] || [ "${CBM_CI_KEEP:-0}" = "1" ]; then
|
||||
return $rc
|
||||
fi
|
||||
# A failure BEFORE any container ran (bad leg name, preflight) never created
|
||||
# a volume; claiming to have "kept" one then sends the reader after nothing.
|
||||
if ! docker volume inspect "${CBM_CI_BUILD_VOLUME}" >/dev/null 2>&1; then
|
||||
return $rc
|
||||
fi
|
||||
if [ $rc -eq 0 ]; then
|
||||
docker volume rm -f "${CBM_CI_BUILD_VOLUME}" >/dev/null 2>&1 || true
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user