Skip to content

Commit 7b66739

Browse files
committed
script: docker: remove docker images of the tested PR when cleaning
Saves disk resources (and forces re-pull, which may be useful for new version) Signed-off-by: Pierre-Etienne Bougué <[email protected]>
1 parent 9a10a58 commit 7b66739

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

scripts/cleanup-db.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ OSRD_VALKEY="osrd-valkey"
2323
OSRD_VALKEY_VOLUME="osrd_valkey_data"
2424
OSRD_POSTGRES_PORT=5432
2525
OSRD_VALKEY_PORT=6379
26-
if [ "$PR_TEST" -eq 1 ]; then
26+
if [ "$PR_TEST" = 1 ]; then
2727
OSRD_POSTGRES="osrd-postgres-pr-tests"
2828
OSRD_EDITOAST="osrd-editoast-pr-tests"
2929
OSRD_VALKEY="osrd-valkey-pr-tests"

scripts/load-backup.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ fi
4141
# These variables are necessary to load the infra on the correct instance (the pr-infra or the dev one)
4242
OSRD_POSTGRES="osrd-postgres"
4343
OSRD_POSTGRES_PORT=5432
44-
if [ "$PR_TEST" -eq 1 ]; then
44+
if [ "$PR_TEST" = 1 ]; then
4545
OSRD_POSTGRES="osrd-postgres-pr-tests"
4646
OSRD_POSTGRES_PORT=5433
4747
fi

scripts/pr-tests-compose.sh

+11-1
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,20 @@ elif [ "$1" = "down" ]; then
7474

7575
else
7676

77-
# Shutdown and clean the docker instance
77+
# Shutdown and clean the docker instance (remove "osrd" images too)
78+
osrd_images=$(docker compose \
79+
-p "osrd-pr-tests" \
80+
-f "docker/docker-compose.pr-tests.yml" \
81+
images --format json \
82+
core editoast osrdyne gateway front \
83+
| jq --raw-output '.[].ID')
84+
7885
docker compose \
7986
-p "osrd-pr-tests" \
8087
-f "docker/docker-compose.pr-tests.yml" \
8188
down -v
8289

90+
# shellcheck disable=SC2086
91+
docker rmi ${osrd_images}
92+
8393
fi

0 commit comments

Comments
 (0)