fix(ci): harden health check with retries and better error reporting
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 14s
Build & Deploy / 🧪 QA (push) Successful in 1m44s
Build & Deploy / 🏗️ Build (push) Successful in 2m50s
Build & Deploy / 🚀 Deploy (push) Successful in 16s
Build & Deploy / 🧪 Post-Deploy Verification (push) Failing after 4m51s
Build & Deploy / 🔔 Notify (push) Successful in 6s

This commit is contained in:
2026-04-13 22:50:53 +02:00
parent 03a3073263
commit 89e3cc462a

View File

@@ -490,25 +490,28 @@ jobs:
DEPLOY_URL: ${{ needs.prepare.outputs.next_public_url }} DEPLOY_URL: ${{ needs.prepare.outputs.next_public_url }}
GK_PASS: ${{ secrets.GATEKEEPER_PASSWORD || 'klz2026' }} GK_PASS: ${{ secrets.GATEKEEPER_PASSWORD || 'klz2026' }}
run: | run: |
echo "Waiting 10s for app to fully start..." echo "Waiting 30s for app to fully start (cold start / migrations)..."
sleep 10 sleep 30
echo "Checking basic health..." echo "Checking basic health..."
curl -sf "$DEPLOY_URL/health" || { echo "❌ Basic health check failed"; exit 1; } curl -sfL --retry 3 --retry-delay 5 "$DEPLOY_URL/health" || { echo "❌ Basic health check failed after retries"; exit 1; }
echo "✅ Basic health OK" echo "✅ Basic health OK"
echo "Checking CMS DB connectivity..." echo "Checking CMS DB connectivity..."
RESPONSE_HEADERS=$(curl -sfI "$DEPLOY_URL/api/health/cms?gk_bypass=$GK_PASS&cb=$(date +%s)" 2>&1) # We use -v to see if we hit Gatekeeper (307) or 503/504
RESPONSE=$(curl -sf "$DEPLOY_URL/api/health/cms?gk_bypass=$GK_PASS&cb=$(date +%s)" 2>&1) || { URL="$DEPLOY_URL/api/health/cms?gk_bypass=$GK_PASS&cb=$(date +%s)"
RESPONSE=$(curl -sfL --retry 3 --retry-delay 5 "$URL" 2>&1) || {
echo "❌ CMS health check failed!" echo "❌ CMS health check failed!"
echo "--- RESPONSE HEADERS ---" echo "--- DEBUG INFO ---"
curl -sI "$DEPLOY_URL/api/health/cms?gk_bypass=$GK_PASS&cb=$(date +%s)" curl -svI "$URL"
echo "--- RESPONSE BODY ---" echo "--- RESPONSE BODY ---"
echo "$RESPONSE" curl -sL "$URL"
echo "" echo ""
echo "This usually means Payload CMS migrations failed or DB tables are missing." echo "This usually means Payload CMS migrations failed or DB tables are missing."
echo "Check: docker logs \$APP_CONTAINER | grep -i error"
exit 1 exit 1
} }
echo "✅ CMS health: $RESPONSE" echo "✅ CMS health: $RESPONSE"
- name: 🚀 OG Image Check - name: 🚀 OG Image Check
if: always() && steps.deps.outcome == 'success' if: always() && steps.deps.outcome == 'success'
env: env: