Improve db readiness and build args parsing

This commit is contained in:
estebanthi
2026-01-05 11:47:40 +01:00
parent bfd6822394
commit 133731d493
2 changed files with 31 additions and 12 deletions

View File

@@ -146,13 +146,26 @@ jobs:
--health-retries=5 \
postgres:16
for i in {1..30}; do
if docker exec "$container_name" pg_isready -U postgres > /dev/null 2>&1; then
break
fi
health="$(docker inspect --format '{{.State.Health.Status}}' "$container_name" 2>/dev/null || true)"
case "$health" in
healthy)
break
;;
unhealthy)
echo "Postgres reported unhealthy." >&2
docker logs "$container_name" || true
exit 1
;;
"")
echo "Postgres health status unavailable." >&2
docker logs "$container_name" || true
exit 1
;;
esac
sleep 1
done
if ! docker exec "$container_name" pg_isready -U postgres > /dev/null 2>&1; then
echo "Postgres did not become ready in time." >&2
if [ "${health:-}" != "healthy" ]; then
echo "Postgres did not become healthy in time." >&2
docker logs "$container_name" || true
exit 1
fi