[Buildkite] Clean Docker environment on exit (#734)

This commit is contained in:
Amir Zarrinkafsh 2020-03-19 16:15:54 +11:00 committed by GitHub
parent 298d56dea3
commit 7eddf07155
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -5,7 +5,7 @@ set +u
if [[ $BUILDKITE_LABEL =~ ":selenium:" ]] || [[ $BUILDKITE_LABEL =~ ":docker: Build Image" ]]; then if [[ $BUILDKITE_LABEL =~ ":selenium:" ]] || [[ $BUILDKITE_LABEL =~ ":docker: Build Image" ]]; then
CONTAINERS=$(docker ps -a -q) CONTAINERS=$(docker ps -a -q)
if [[ ${CONTAINERS} != "" ]]; then if [[ ${CONTAINERS} != "" ]]; then
echo "--- :docker: Clean environment" echo "--- :docker: Remove lingering containers"
docker rm -f ${CONTAINERS} docker rm -f ${CONTAINERS}
fi fi
fi fi

6
.buildkite/hooks/pre-exit Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash
set +u
echo "--- :docker: Clean environment"
docker system prune -af --volumes