From bbf52d79f643aab105bc19f6f9171713fcd7fa24 Mon Sep 17 00:00:00 2001 From: Craig Comstock Date: Fri, 20 Oct 2023 15:11:18 -0500 Subject: [PATCH] Improved ci/clean-build-package.sh for use on a new system Check if things exist before trying to remove them. Ticket: none Changelog: none (cherry picked from commit d8bac4df2d8ce5a26f79ebb8b1c5d5edeeacf9bd) --- ci/clean-build-package.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/ci/clean-build-package.sh b/ci/clean-build-package.sh index a36691cda..43988ccdb 100755 --- a/ci/clean-build-package.sh +++ b/ci/clean-build-package.sh @@ -3,6 +3,12 @@ set -ex # clean up docker stuff name=cfengine-build-package # TODO: a softer clean might get into the container and run ./buildscripts/build-scripts/clean-buildmachine -docker stop $name -docker rm -f $name -docker rmi -f $name +if docker ps | grep $name; then + docker stop $name +fi +if docker ps -a | grep $name; then + docker rm $name +fi +if docker images | grep $name; then + docker rmi -f $name +fi