Skip to content

Commit

Permalink
script: docker: remove docker images of the tested PR when cleaning
Browse files Browse the repository at this point in the history
Saves disk resources
(and forces re-pull, which may be useful for new version)

Signed-off-by: Pierre-Etienne Bougué <bougue.pe@proton.me>
  • Loading branch information
bougue-pe committed Dec 9, 2024
1 parent 9c34c10 commit c4c02df
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion scripts/cleanup-db.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ OSRD_VALKEY="osrd-valkey"
OSRD_VALKEY_VOLUME="osrd_valkey_data"
OSRD_POSTGRES_PORT=5432
OSRD_VALKEY_PORT=6379
if [ "$PR_TEST" -eq 1 ]; then
if [ "$PR_TEST" = 1 ]; then
OSRD_POSTGRES="osrd-postgres-pr-tests"
OSRD_EDITOAST="osrd-editoast-pr-tests"
OSRD_VALKEY="osrd-valkey-pr-tests"
Expand Down
2 changes: 1 addition & 1 deletion scripts/load-backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ fi
# These variables are necessary to load the infra on the correct instance (the pr-infra or the dev one)
OSRD_POSTGRES="osrd-postgres"
OSRD_POSTGRES_PORT=5432
if [ "$PR_TEST" -eq 1 ]; then
if [ "$PR_TEST" = 1 ]; then
OSRD_POSTGRES="osrd-postgres-pr-tests"
OSRD_POSTGRES_PORT=5433
fi
Expand Down
12 changes: 11 additions & 1 deletion scripts/pr-tests-compose.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,20 @@ elif [ "$1" = "down" ]; then

else

# Shutdown and clean the docker instance
# Shutdown and clean the docker instance (remove "osrd" images too)
osrd_images=$(docker compose \
-p "osrd-pr-tests" \
-f "docker/docker-compose.pr-tests.yml" \
images --format json \
core editoast osrdyne gateway front \
| jq --raw-output '.[].ID')

docker compose \
-p "osrd-pr-tests" \
-f "docker/docker-compose.pr-tests.yml" \
down -v

# shellcheck disable=SC2086
docker rmi ${osrd_images}

fi

0 comments on commit c4c02df

Please sign in to comment.