diff --git a/docker_test.sh b/docker_test.sh index 9b8dab638e924620499caef909c9da028f21f2f4..c8b17fa2faba86fd7d78fdd44753374b0b3bfa69 100755 --- a/docker_test.sh +++ b/docker_test.sh @@ -1,6 +1,8 @@ -#!/bin/sh +#!/bin/bash -function usage() { +set -e + +usage() { echo -e "usage:\t$0 DIRECTORY, e.g. $0 pica-mattermost" echo -e "\tDIRECTORY : name of the directory containing docker-compose.yml\n" echo "This script simulates the first launch of a service : it will recreate all existing volumes for the service" @@ -30,14 +32,21 @@ fi # Go to the folder of the service which will be tested cd "$1" -echo -e "Starting procedure for $1...\n" +echo -e "Starting procedure for \033[31m$1\e[0m..." echo -e "\n==== Stop and remove existing containers ====" docker-compose down -echo "==== Reset and pull Dockerfiles repository ====" -echo "Using branch" $(git branch --show-current) -git reset --hard -git pull +echo -e "\n==== RESET HARD and pull Dockerfiles repository ====" +echo -e "Using branch \033[31m $(git rev-parse --abbrev-ref HEAD)\e[0m, is this correct ? [y/N]" +read ans + +if [ $ans == "y" ]; then + git reset --hard + git pull +else + echo "Aborting." + exit 0 +fi echo -e "\n==== Remove and re-create named external volumes ====" for v in $(docker-compose config --volumes); do @@ -50,7 +59,7 @@ docker-compose pull echo -e "\n==== Replace production URL with testing URL in all files ====" for f in $(grep -l -r ".picasoft.net" .); do - echo -e "\t*" ${f} + echo -e "\tFound in" ${f} sed -i "s/.picasoft.net/.test.picasoft.net/g" ${f} done