76be3289a073ee703ab5ae33a13aecc38bb644fe
[integration/csit.git] / scripts / externalapi-nbi / delete_nbi_containers.sh
1 #!/bin/bash
2 # ========================================================================
3 # Copyright (c) 2018 Orange
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 # http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 # ========================================================================
16
17 echo "This is ${WORKSPACE}/test/csit/scripts/externalapi-nbi/delete_nbi_containers.sh"
18
19 # Check if docker-compose file exists
20 if [ ! -f "$WORKSPACE/externalapi-nbi/docker-compose.yml" ]; then
21     echo 'There is nothing to clean. Exiting...' >&2
22     exit 0
23 fi
24
25 cd $WORKSPACE/externalapi-nbi
26
27 # Remove containers and attached/anonymous volume(s)
28 docker-compose down -v
29 # Force stop & remove all containers and volumes
30 docker-compose rm -f -s -v
31
32 # clean up
33 rm -rf $WORKSPACE/externalapi-nbi