diff options
author | Adin Scannell <ascannell@google.com> | 2021-07-12 09:59:40 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-07-12 10:03:04 -0700 |
commit | 1f396d8c16e179aa5b7b9ea1da6b16fb0b167016 (patch) | |
tree | f0d32714b0dd78ec27ec02ffaf1847c668ebd514 /.buildkite/hooks | |
parent | 36a17a814bf90bad33eac25ddbb7a416143a4be7 (diff) |
Prevent the cleanup script from destroying any "bootstrap" containers.
PiperOrigin-RevId: 384257460
Diffstat (limited to '.buildkite/hooks')
-rw-r--r-- | .buildkite/hooks/post-command | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/.buildkite/hooks/post-command b/.buildkite/hooks/post-command index c4c6fc90c..5e6db407a 100644 --- a/.buildkite/hooks/post-command +++ b/.buildkite/hooks/post-command @@ -56,8 +56,10 @@ if test "${BUILDKITE_COMMAND_EXIT_STATUS}" -ne "0"; then sudo rm -rf "${HOME}/go" fi -# Kill any running containers (clear state). -CONTAINERS="$(docker ps -q)" -if ! test -z "${CONTAINERS}"; then - docker container kill ${CONTAINERS} 2>/dev/null || true -fi +# Kill any running containers (clear state), except for "bootstrap". +for container in $(docker ps -q); do + maybe_kill="$(docker inspect -f '{{if ne "/bootstrap" .Name}}true{{ end }}' "${container}")" + if test -n "${maybe_kill}"; then + docker container kill "${container}" + fi +done
\ No newline at end of file |