diff --git a/tests/docker-scripts/run.sh b/tests/docker-scripts/run.sh index 7151870f8c..a3fe123bab 100755 --- a/tests/docker-scripts/run.sh +++ b/tests/docker-scripts/run.sh @@ -6,13 +6,14 @@ # because docker compose run starts dependent containers, but does not stop them pushd "$(dirname "$0")" # Set pwd to this directory -args=("$@") - -# If we are not in CI, remove the container after running. In CI we want to keep -# the container around in case we need to dump the logs in another step of the -# GH action. It should be cleaned up automatically by the CI runner. -if [[ -z "${CI}" ]]; then - args=(--rm "${args[@]}") +if [[ -n "${CI}" ]]; then + # If we are in CI, keep the container around after stopping in case we need to + # dump the logs in another step of the GH action. It should be cleaned up + # automatically by the CI runner. + args=("$@") +else + # Remove the container when not in CI + args=(--rm "$@") fi echo docker compose run --service-ports --build "${args[@]}"