Skip to content

Commit

Permalink
script: change call arguments for shutting down the docker + fix help…
Browse files Browse the repository at this point in the history
… not showing on certain cases
  • Loading branch information
EthanPERRUZZA committed Oct 22, 2024
1 parent f79e009 commit f15559f
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions scripts/pr-tests-compose.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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 \
Expand Down

0 comments on commit f15559f

Please sign in to comment.