Do not block deploy on AI service health
This commit is contained in:
@@ -89,30 +89,27 @@ jobs:
|
|||||||
docker compose ps
|
docker compose ps
|
||||||
AI_CONTAINER_ID="$(docker compose ps -q ai-service)"
|
AI_CONTAINER_ID="$(docker compose ps -q ai-service)"
|
||||||
if [ -z "$AI_CONTAINER_ID" ]; then
|
if [ -z "$AI_CONTAINER_ID" ]; then
|
||||||
echo "AI service container id could not be resolved after deploy."
|
echo "AI service container id could not be resolved after deploy. Continuing because AI is not a deploy gate for the core app."
|
||||||
docker compose ps
|
else
|
||||||
docker compose logs --tail=200 ai-service || true
|
ATTEMPTS=90
|
||||||
exit 1
|
SLEEP_SECS=2
|
||||||
fi
|
i=1
|
||||||
ATTEMPTS=90
|
while [ "$i" -le "$ATTEMPTS" ]; do
|
||||||
SLEEP_SECS=2
|
HEALTH_STATUS="$(docker inspect -f '{{if .State.Health}}{{.State.Health.Status}}{{else}}none{{end}}' "$AI_CONTAINER_ID" 2>/dev/null || echo unknown)"
|
||||||
i=1
|
if [ "$HEALTH_STATUS" = "healthy" ]; then
|
||||||
while [ "$i" -le "$ATTEMPTS" ]; do
|
break
|
||||||
HEALTH_STATUS="$(docker inspect -f '{{if .State.Health}}{{.State.Health.Status}}{{else}}none{{end}}' "$AI_CONTAINER_ID" 2>/dev/null || echo unknown)"
|
fi
|
||||||
if [ "$HEALTH_STATUS" = "healthy" ]; then
|
if [ "$HEALTH_STATUS" = "unhealthy" ]; then
|
||||||
break
|
echo "AI service became unhealthy during deploy readiness wait. Continuing because AI is not a deploy gate for the core app."
|
||||||
fi
|
docker compose logs --tail=200 ai-service || true
|
||||||
if [ "$HEALTH_STATUS" = "unhealthy" ]; then
|
break
|
||||||
echo "AI service became unhealthy during deploy readiness wait."
|
fi
|
||||||
|
sleep "$SLEEP_SECS"
|
||||||
|
i=$((i + 1))
|
||||||
|
done
|
||||||
|
if [ "${HEALTH_STATUS:-unknown}" != "healthy" ]; then
|
||||||
|
echo "AI service did not become healthy within $((ATTEMPTS * SLEEP_SECS)) seconds. Final status: ${HEALTH_STATUS:-unknown}. Continuing because AI is not a deploy gate for the core app."
|
||||||
|
docker compose ps
|
||||||
docker compose logs --tail=200 ai-service || true
|
docker compose logs --tail=200 ai-service || true
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
sleep "$SLEEP_SECS"
|
|
||||||
i=$((i + 1))
|
|
||||||
done
|
|
||||||
if [ "$HEALTH_STATUS" != "healthy" ]; then
|
|
||||||
echo "AI service did not become healthy within $((ATTEMPTS * SLEEP_SECS)) seconds. Final status: ${HEALTH_STATUS:-unknown}"
|
|
||||||
docker compose ps
|
|
||||||
docker compose logs --tail=200 ai-service || true
|
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|||||||
+1
-2
@@ -62,9 +62,8 @@ fi
|
|||||||
|
|
||||||
ai_status="$(compose ps ai-service --format '{{.State}}' 2>/dev/null | head -n 1 | tr '[:upper:]' '[:lower:]')"
|
ai_status="$(compose ps ai-service --format '{{.State}}' 2>/dev/null | head -n 1 | tr '[:upper:]' '[:lower:]')"
|
||||||
if [ "$ai_status" != "running" ]; then
|
if [ "$ai_status" != "running" ]; then
|
||||||
echo "AI service is not healthy after deploy (state: ${ai_status:-unknown})."
|
echo "AI service is not healthy after deploy (state: ${ai_status:-unknown}). Continuing because AI is not a deploy gate for the core app."
|
||||||
compose logs --tail=200 ai-service || true
|
compose logs --tail=200 ai-service || true
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "${APP_PUBLIC_BASE_URL:-}" ]; then
|
if [ -n "${APP_PUBLIC_BASE_URL:-}" ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user