@@ -42,28 +42,29 @@ jobs:
4242 - name : Wait for services to be healthy
4343 run : |
4444 echo "Waiting for services to become healthy..."
45- # This command will wait for the healthchecks defined in docker-compose.yml to pass.
46- # It will exit with an error if the services do not become healthy within the timeout.
47- docker compose ps
4845 max_wait=300
4946 current_wait=0
5047 while [ $current_wait -lt $max_wait ]; do
51- web_status =$(docker compose ps --format json web | jq -r '.[0].Health' 2>/dev/null || docker inspect -f ' {{.State.Health.Status}}' $(docker compose ps -q web) )
52- firebird_status =$(docker compose ps --format json firebird | jq -r '.[0].Health' 2>/dev/null || docker inspect -f ' {{.State.Health.Status}}' $(docker compose ps -q firebird) )
48+ firebird_status =$(docker inspect --format=' {{.State.Health.Status}}' $(docker compose ps -q firebird) 2>/dev/null || echo "starting" )
49+ web_status =$(docker inspect --format=' {{.State.Health.Status}}' $(docker compose ps -q web) 2>/dev/null || echo "starting" )
5350
54- if [ "$web_status" = "healthy" ] && [ "$firebird_status" = "healthy" ]; then
55- echo "Services are healthy!"
51+ echo "Status: Firebird=$firebird_status, Web=$web_status (${current_wait}s)"
52+
53+ if [ "$firebird_status" = "healthy" ] && [ "$web_status" = "healthy" ]; then
54+ echo "All services are healthy!"
5655 exit 0
5756 fi
58- echo "Waiting... Web: $web_status, Firebird: $firebird_status"
57+
5958 sleep 10
6059 current_wait=$((current_wait + 10))
6160 done
62- echo "Services did not become healthy in time."
63- echo "--- Firebird Healthcheck Logs ---"
64- docker inspect --format='{{json .State.Health}}' $(docker compose ps -q firebird)
65- echo "--- Web Healthcheck Logs ---"
66- docker inspect --format='{{json .State.Health}}' $(docker compose ps -q web)
61+
62+ echo "ERROR: Services did not become healthy in time."
63+ echo "--- Firebird Detailed Status ---"
64+ docker inspect $(docker compose ps -q firebird)
65+ echo "--- Web Detailed Status ---"
66+ docker inspect $(docker compose ps -q web)
67+ echo "--- Container Logs ---"
6768 docker compose logs
6869 exit 1
6970
0 commit comments