X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=jjb%2Fdovetail%2Fdovetail-cleanup.sh;h=2d66fe02259d8bb96e1c09a61ecd32111e54d1db;hb=36c14723267e81a7f0f0e35232436566872789d8;hp=0ee789a97e690a9e8350d2ac9670508c2292a7f0;hpb=909e6cb7ca87e97764f11555737a85ef89d5d513;p=releng.git diff --git a/jjb/dovetail/dovetail-cleanup.sh b/jjb/dovetail/dovetail-cleanup.sh index 0ee789a97..2d66fe022 100755 --- a/jjb/dovetail/dovetail-cleanup.sh +++ b/jjb/dovetail/dovetail-cleanup.sh @@ -1,20 +1,27 @@ #!/bin/bash +############################################################################## +# Copyright (c) 2017 Huawei Technologies Co.,Ltd and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## [[ $CI_DEBUG == true ]] && redirect="/dev/stdout" || redirect="/dev/null" # clean up dependent project docker images, which has no containers and image tag None clean_images=(opnfv/functest opnfv/yardstick opnfv/testapi mongo) for clean_image in "${clean_images[@]}"; do - echo "Removing image $image_id, which has no containers and image tag is None" dangling_images=($(docker images -f "dangling=true" | grep ${clean_image} | awk '{print $3}')) if [[ -n ${dangling_images} ]]; then for image_id in "${dangling_images[@]}"; do + echo "Removing image $image_id, which has no containers and image tag is None" docker rmi $image_id >${redirect} done fi done -echo "Remove containers with image opnfv/dovetail:..." +echo "Remove dovetail images with tag None and containers with these images ..." dangling_images=($(docker images -f "dangling=true" | grep opnfv/dovetail | awk '{print $3}')) if [[ -n ${dangling_images} ]]; then for image_id in "${dangling_images[@]}"; do @@ -30,13 +37,13 @@ if [[ ! -z $(docker ps -a | grep opnfv/dovetail) ]]; then docker ps -a | grep opnfv/dovetail | awk '{print $1}' | xargs docker rm -f >${redirect} fi -echo "Remove dovetail existing images if exist..." -if [[ ! -z $(docker images | grep opnfv/dovetail) ]]; then - echo "Docker images to remove:" - docker images | head -1 && docker images | grep opnfv/dovetail >${redirect} - image_tags=($(docker images | grep opnfv/dovetail | awk '{print $2}')) - for tag in "${image_tags[@]}"; do - echo "Removing docker image opnfv/dovetail:$tag..." - docker rmi opnfv/dovetail:$tag >${redirect} - done -fi +#echo "Remove dovetail existing images if exist..." +#if [[ ! -z $(docker images | grep opnfv/dovetail) ]]; then +# echo "Docker images to remove:" +# docker images | head -1 && docker images | grep opnfv/dovetail >${redirect} +# image_tags=($(docker images | grep opnfv/dovetail | awk '{print $2}')) +# for tag in "${image_tags[@]}"; do +# echo "Removing docker image opnfv/dovetail:$tag..." +# docker rmi opnfv/dovetail:$tag >${redirect} +# done +#fi