From f15559fdfb0dca38a72dd52c660cf1a3dd319596 Mon Sep 17 00:00:00 2001 From: Ethan Perruzza Date: Tue, 22 Oct 2024 14:29:45 +0200 Subject: [PATCH] script: change call arguments for shutting down the docker + fix help not showing on certain cases --- scripts/pr-tests-compose.sh | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/scripts/pr-tests-compose.sh b/scripts/pr-tests-compose.sh index 20cd474f7a5..d974243ee67 100755 --- a/scripts/pr-tests-compose.sh +++ b/scripts/pr-tests-compose.sh @@ -17,26 +17,35 @@ esac if { [ "$#" -eq 3 ] && - [ "$2" != "up-and-load-backup" ] + [ "$2" != "up-and-load-backup" ] } || { [ "$#" -eq 2 ] && - { [ "$2" != "up" ] && - [ "$2" != "down" ] && - [ "$2" != "down-and-clean" ] - } + [ "$2" != "up" ] + } || + { + [ "$#" -eq 1 ] && + [ "$1" != "down" ] && + [ "$1" != "down-and-clean" ] + } || + { + [ "$#" -ne 1 ] && + [ "$#" -ne 2 ] && + [ "$#" -ne 3 ] }; then - echo "Usage: $0 pr-number (up | up-and-load-backup [osrd.backup] | down | down-and-clean )" >&2 + echo "Usage: $0 ( [pr-number] (up | up-and-load-backup [osrd.backup]) | down | down-and-clean )" >&2 exit 1 fi # Change ports in needed files -export PR_NB="pr-$1" +export PR_NB="" # We export a blank string for down and down-and-clean options not to produce a warning if [ "$2" = "up" ] || [ "$2" = "up-and-load-backup" ]; then + export PR_NB="pr-$1" + if [ "$2" = "up-and-load-backup" ]; then docker compose \ @@ -55,7 +64,7 @@ if [ "$2" = "up" ] || [ "$2" = "up-and-load-backup" ]; then -f "docker/docker-compose.pr-tests.yml" \ up -d -elif [ "$2" = "down" ]; then +elif [ "$1" = "down" ]; then # Shutdown the docker instance docker compose \