Skip to content

Commit

Permalink
Kill running docker containers left over from a previous job
Browse files Browse the repository at this point in the history
  • Loading branch information
mvines committed Feb 6, 2019
1 parent afdf0ef commit 7452486
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .buildkite/hooks/post-checkout
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
CI_BUILD_START=$(date +%s)
export CI_BUILD_START

#
# Kill any running docker containers, which are potentially left over from the
# previous CI job
#
(
containers=$(docker ps -q)
if [[ -n $containers ]]; then
echo "Killing stale docker containers"
docker ps

# shellcheck disable=SC2086 # Don't want to double quote $containers
docker kill $containers
fi
)

# Processes from previously aborted CI jobs seem to loiter, unclear why as one
# would expect the buildkite-agent to clean up all child processes of the
# aborted CI job.
Expand Down

0 comments on commit 7452486

Please sign in to comment.