summaryrefslogtreecommitdiffstats
path: root/jjb/functest
diff options
context:
space:
mode:
authorjose.lausuch <jose.lausuch@ericsson.com>2015-11-18 15:12:24 +0100
committerjose.lausuch <jose.lausuch@ericsson.com>2015-11-18 15:12:24 +0100
commit51a71e9464ad5088e5f72c374c5da9d2ad85ea42 (patch)
tree079253fe7486303b2e4c9f59ca36819a9c842bc5 /jjb/functest
parent8f2d9b3370df2b32d7a959bb3c39ff2e43c533a1 (diff)
Remove docker images forced in Functest docker job
JIRA: FUNCTEST-78 Change-Id: Ifb868bdd95af96a6effb92d6170222efd0564324 Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
Diffstat (limited to 'jjb/functest')
-rw-r--r--jjb/functest/functest-docker.sh22
1 files changed, 14 insertions, 8 deletions
diff --git a/jjb/functest/functest-docker.sh b/jjb/functest/functest-docker.sh
index 6f752c221..54315cad1 100644
--- a/jjb/functest/functest-docker.sh
+++ b/jjb/functest/functest-docker.sh
@@ -15,7 +15,8 @@ DOCKER_IMAGE_NAME="opnfv/functest"
cd $WORKSPACE
git clone https://gerrit.opnfv.org/gerrit/releng
-DOCKER_TAG=$($WORKSPACE/releng/utils/calculate_version.sh -t docker -n $DOCKER_IMAGE_NAME)
+DOCKER_TAG=$($WORKSPACE/releng/utils/calculate_version.sh -t docker \
+ -n $DOCKER_IMAGE_NAME)
ret_val=$?
if [ $ret_val -ne 0 ]; then
@@ -25,17 +26,22 @@ else
echo "Tag version to be build and pushed: $DOCKER_TAG"
fi
-# Remove previous running containers
-echo "Removing existing $DOCKER_IMAGE_NAME containers..."
+# Remove previous running containers if exist
if [[ ! -z $(docker ps -a | grep $DOCKER_IMAGE_NAME) ]]; then
- docker ps | grep $DOCKER_IMAGE_NAME | awk '{{print $1}}' | xargs docker stop &>/dev/null
- docker ps -a | grep $DOCKER_IMAGE_NAME | awk '{{print $1}}' | xargs docker rm &>/dev/null
+ echo "Removing existing $DOCKER_IMAGE_NAME containers..."
+ docker ps | grep $DOCKER_IMAGE_NAME | awk '{{print $1}}' | xargs docker stop
+ docker ps -a | grep $DOCKER_IMAGE_NAME | awk '{{print $1}}' | xargs docker rm
fi
-# Remove existing images
-echo "Removing existing $DOCKER_IMAGE_NAME images..."
+# list the images
+echo "Available images are:"
+docker images
+
+# Remove existing images if exist
if [[ ! -z $(docker images | grep $DOCKER_IMAGE_NAME) ]]; then
- docker images | grep $DOCKER_IMAGE_NAME | awk '{{print $3}}' | xargs docker rmi &>/dev/null
+ echo "Removing existing $DOCKER_IMAGE_NAME images..."
+ docker images | grep $DOCKER_IMAGE_NAME | awk '{{print $3}}' \
+ | xargs docker rmi -f
fi