diff --git a/infra/wait-healthy.sh b/infra/wait-healthy.sh index a054f70..987abc2 100755 --- a/infra/wait-healthy.sh +++ b/infra/wait-healthy.sh @@ -15,9 +15,13 @@ set -euo pipefail timeout="${WAIT_TIMEOUT:-420}" deadline=$(( $(date +%s) + timeout )) -# compose service name -> container id. The name filter matches both docker -# compose ("infra-openzaak-1") and podman-compose ("infra_openzaak_1") naming. -cid_for() { docker ps -aq --filter "name=$1" | head -1; } +# compose service name -> container id. `--filter name=` is a substring match, so it is anchored on +# the compose replica suffix — otherwise 'objecten' also matches objecten-db / objecten-redis / +# objecten-celery, and 'objecttypen' matches objecttypen-db. Whichever docker listed first won, so a +# service with a sibling that has no healthcheck timed out with status=none while it was in fact +# healthy. The pattern matches both docker compose ("infra-objecten-1") and podman-compose +# ("infra_objecten_1") naming; the same anchoring the verify check scripts use. +cid_for() { docker ps -aq --filter "name=$1[-_][0-9]+\$" | head -1; } for svc in "$@"; do echo "waiting for '$svc' to be healthy (timeout ${timeout}s)..."