Merge "Dial in docker and ssh environment"
[releng.git] / jjb / qtip / helpers / cleanup-deploy.sh
1 #!/bin/bash
2 ##############################################################################
3 # Copyright (c) 2016 ZTE and others.
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
9 # Remove previous running containers if exist
10 if [[ ! -z $(docker ps -a | grep "opnfv/qtip:$DOCKER_TAG") ]]; then
11     echo "Removing existing opnfv/qtip containers..."
12     # workaround: sometimes it throws an error when stopping qtip container.
13     # To make sure ci job unblocked, remove qtip container by force without stopping it.
14     docker rm -f $(docker ps -a | grep "opnfv/qtip:$DOCKER_TAG" | awk '{print $1}')
15 fi
16
17 # Remove existing images if exist
18 if [[ $(docker images opnfv/qtip:${DOCKER_TAG} | wc -l) -gt 1 ]]; then
19     echo "Removing docker image opnfv/qtip:$DOCKER_TAG..."
20     docker rmi opnfv/qtip:$DOCKER_TAG
21 fi