summaryrefslogtreecommitdiffstats
path: root/jjb/yardstick/yardstick-cleanup.sh
diff options
context:
space:
mode:
authorFatih Degirmenci <fatih.degirmenci@ericsson.com>2016-05-22 23:19:15 +0200
committerFatih Degirmenci <fatih.degirmenci@ericsson.com>2016-05-24 06:40:15 +0000
commit4f84bf5c43fa1ffd333a79075af60ba836a803ab (patch)
tree4740277727d6dcfd9739b554eaa1d384a50feca0 /jjb/yardstick/yardstick-cleanup.sh
parent1fb927120976927b5b32fd9d6090881480529350 (diff)
yardstick: Take builders out of jjb
Change-Id: I246bcdd9f1fa300639bd7ec744cefe82e293b222 Signed-off-by: Fatih Degirmenci <fatih.degirmenci@ericsson.com>
Diffstat (limited to 'jjb/yardstick/yardstick-cleanup.sh')
-rwxr-xr-xjjb/yardstick/yardstick-cleanup.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/jjb/yardstick/yardstick-cleanup.sh b/jjb/yardstick/yardstick-cleanup.sh
new file mode 100755
index 000000000..4e6f7d680
--- /dev/null
+++ b/jjb/yardstick/yardstick-cleanup.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+[[ $CI_DEBUG == true ]] && redirect="/dev/stdout" || redirect="/dev/null"
+
+echo "Cleaning up docker containers/images..."
+# Remove previous running containers if exist
+if [[ ! -z $(docker ps -a | grep opnfv/yardstick) ]]; then
+ echo "Removing existing opnfv/yardstick containers..."
+ docker ps -a | grep opnfv/yardstick | awk '{print $1}' | xargs docker rm -f >$redirect
+
+fi
+
+# Remove existing images if exist
+if [[ ! -z $(docker images | grep opnfv/yardstick) ]]; then
+ echo "Docker images to remove:"
+ docker images | head -1 && docker images | grep opnfv/yardstick
+ image_tags=($(docker images | grep opnfv/yardstick | awk '{print $2}'))
+ for tag in "${image_tags[@]}"; do
+ echo "Removing docker image opnfv/yardstick:$tag..."
+ docker rmi opnfv/yardstick:$tag >$redirect
+
+ done
+fi