ci(test): purge aussi les conteneurs postgres-* orphelins au démarrage
Some checks failed
CI / lint (push) Successful in 3m35s
CI / build (push) Successful in 3m44s
CI / intent-service-test (push) Successful in 5m31s
CI / e2e (push) Failing after 13m53s
CI / test (push) Failing after 17m41s

Les essais 1-2 de cette branche (nom de conteneur Postgres par run) ont
laissé des conteneurs `postgres-122` / `postgres-125` en marche sur le
runner persistant : leur teardown `if: always()` n'a pas tourné (ce runner
saute les étapes finales après un échec) et rien d'autre ne cible ce
préfixe. Un 2e Postgres inactif affame la RAM du runner → requêtes ~5×
plus lentes → `resetDatabase()` dépasse le timeout Mocha. L'étape « Start
Postgres » retire maintenant tout `postgres-*` en plus du `postgres` nu ;
plus rien ne crée ce préfixe, donc ça ne touche que ces résidus.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Nicolas 2026-09-06 10:35:08 +02:00
parent b5c557c3f6
commit 0355b1cd99

View file

@ -132,6 +132,15 @@ jobs:
| awk '{print $1}')" | awk '{print $1}')"
echo "job network: ${net:?could not determine the job container network}" echo "job network: ${net:?could not determine the job container network}"
docker rm -f postgres >/dev/null 2>&1 || true docker rm -f postgres >/dev/null 2>&1 || true
# Also drop any `postgres-<suffix>` container. A since-reverted
# attempt at per-run Postgres naming on this branch left some
# running on this persistent runner (their `if: always()` teardown
# never fired — this runner skips trailing steps after a failure),
# and nothing else removes them. A second idle Postgres here starves
# the runner's RAM and slows every query ~5x → `resetDatabase()`
# blows Mocha's 10s hook timeout. Nothing creates `postgres-*` any
# more, so this only ever clears that debris.
docker ps -aq --filter 'name=^postgres-' | xargs -r docker rm -f >/dev/null 2>&1 || true
docker run -d --name postgres --network "$net" \ docker run -d --name postgres --network "$net" \
-e POSTGRES_USER=ci -e POSTGRES_PASSWORD=ci -e POSTGRES_DB=batchcooking_ci \ -e POSTGRES_USER=ci -e POSTGRES_PASSWORD=ci -e POSTGRES_DB=batchcooking_ci \
postgres:16-alpine postgres:16-alpine