ci: use array for running containers in preexit (#56059)

* grab some more verbose logging for exit hook

* use array
This commit is contained in:
Dave Try 2023-08-21 10:28:31 -05:00 committed by GitHub
parent f7a34cbbad
commit f7ed60bf61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,7 +17,9 @@ if [[ "$BUILDKITE_AGENT_META_DATA_QUEUE" == "bazel" ]]; then
# Remove any hanging containers and/or volumes to ensure the next tests are able to run.
if [[ $(docker ps -aq | wc -l) -gt 0 ]]; then
docker rm -f "$(docker ps -aq)"
echo "Removing docker containers..."
mapfile -t containers < <(docker ps -aq)
for c in "${containers[@]}"; do docker rm -f "$c"; done
fi
if [[ $(docker volume ls -q) -gt 0 ]]; then
docker volume rm "$(docker volume ls -q)"