-
Notifications
You must be signed in to change notification settings - Fork 280
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CI] Cleanup Docker for CI Build (#731)
* Cleanup jenkins for continous integration build * Cleanup with more keywords * fix bash syntax * Delete metric image as well
- Loading branch information
Showing
2 changed files
with
35 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,31 @@ | ||
# This script will delete all testing containers and images | ||
# available on this machine. | ||
set -x | ||
|
||
CLIPPER_REGISTRY=clippertesting | ||
|
||
# best effort, ignore all errors | ||
try_cleanup() { | ||
(docker ps --all | grep "$@" | awk '{ print $1 }' | xargs docker kill) || true | ||
(docker container ls --all | grep "$@" | awk '{ print $3 }' | xargs docker container rm) || true | ||
(docker image ls --all | grep "$@" | awk '{ print $3 }' | xargs docker image rm -f) || true | ||
docker image prune -f | ||
} | ||
|
||
try_cleanup_docker_volume() { | ||
(docker volume ls -f dangling=true | awk '{ print $2 }' | xargs docker volume rm -f) || true | ||
} | ||
try_cleanup ${CLIPPER_REGISTRY} > /dev/null | ||
try_cleanup shipyard > /dev/null | ||
try_cleanup_docker_volume > /dev/null | ||
KEYWORDS=( | ||
${CLIPPER_REGISTRY} | ||
clipper | ||
redis | ||
model | ||
prometheus | ||
fluentd | ||
metric | ||
) | ||
|
||
echo "Docker Status Before" | ||
docker ps | ||
|
||
for i in "${KEYWORDS[@]}" | ||
do | ||
try_cleanup "$i" | ||
done | ||
|
||
echo "Docker Status After" | ||
docker ps |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters