fix(ci): verify job spesifik deployment_uuid'yi izlesin

Ne yaptık:
- deploy job: Coolify response'undan deployment_uuid parse edip
  GITHUB_OUTPUT'a yazıyor.
- verify job: artık uygulama UUID'si yerine spesifik deployment UUID'sini
  polluyor (queued → in_progress → finished/failed geçişleri).
- Polling süresi 5 dk → 10 dk (max 60 × 10s).

Neden yaptık:
- Eski verify uygulama UUID'sini polling ediyordu. Yeni deploy başlamadan
  önceki eski "running:healthy" status'u yakalayıp 4 saniyede early-exit
  yapıyordu. Workflow yeşil görünür ama gerçek deploy'u doğrulamamış olur.
- Yeni davranış: workflow gerçekten Coolify deploy'unun bitmesini bekliyor.
  Fail olursa workflow da fail eder, notify-failure job tetiklenir.
This commit is contained in:
2026-04-25 16:02:45 +03:00
parent e007cfc398
commit d9a6dda190

View File

@@ -172,14 +172,19 @@ jobs:
# ───────────────────────────────────────────────────────────────────────────
# ADIM 3 — Coolify deploy webhook
# Deployment UUID'yi output'a yaz → verify job bu spesifik deploy'u izleyecek
# ───────────────────────────────────────────────────────────────────────────
deploy:
name: 🚀 Deploy to Coolify
needs: [build-push-backend, build-push-frontend]
runs-on: ubuntu-latest
outputs:
deployment_uuid: ${{ steps.trigger.outputs.deployment_uuid }}
steps:
- name: Trigger Coolify deploy
id: trigger
run: |
response=$(curl -s -w "\n%{http_code}" \
-X POST "${{ secrets.COOLIFY_BASE_URL }}/api/v1/deploy?uuid=${{ secrets.COOLIFY_TRENDYOL_UUID }}&force=true" \
@@ -191,10 +196,15 @@ jobs:
echo "❌ Coolify deploy trigger failed!"
exit 1
fi
echo "✅ Coolify deploy queued"
# Deployment UUID'yi parse et
DEPLOY_UUID=$(echo "$body" | python3 -c "import json,sys; d=json.load(sys.stdin); print(d['deployments'][0]['deployment_uuid'])")
echo "deployment_uuid=$DEPLOY_UUID" >> "$GITHUB_OUTPUT"
echo "✅ Coolify deploy queued — deployment_uuid: $DEPLOY_UUID"
# ───────────────────────────────────────────────────────────────────────────
# ADIM 4 — Verify deployment (Coolify polling + public URL health check)
# ADIM 4 — Verify deployment
# Spesifik deployment_uuid'yi poll et: queued → in_progress → finished/failed
# ───────────────────────────────────────────────────────────────────────────
verify:
name: ✅ Verify Deployment
@@ -202,26 +212,29 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Coolify deployment durumu polling
- name: Coolify deployment status polling
run: |
APP_URL="${{ secrets.COOLIFY_BASE_URL }}/api/v1/applications/${{ secrets.COOLIFY_TRENDYOL_UUID }}"
MAX=30 # 30 × 10s = 5 dk
DEPLOY_UUID="${{ needs.deploy.outputs.deployment_uuid }}"
DEPLOY_URL="${{ secrets.COOLIFY_BASE_URL }}/api/v1/deployments/$DEPLOY_UUID"
MAX=60 # 60 × 10s = 10 dk
INTERVAL=10
echo "🔍 Polling deployment $DEPLOY_UUID"
for i in $(seq 1 $MAX); do
STATUS=$(curl -s --max-time 10 \
-H "Authorization: Bearer ${{ secrets.COOLIFY_API_TOKEN }}" \
"$APP_URL" 2>/dev/null | grep -o '"status":"[^"]*"' | head -1 | cut -d'"' -f4 || echo "unknown")
"$DEPLOY_URL" 2>/dev/null | python3 -c "import json,sys; print(json.load(sys.stdin).get('status','?'))" 2>/dev/null || echo "unknown")
echo "[$i/$MAX] Coolify status: $STATUS"
echo "[$i/$MAX] $STATUS"
case "$STATUS" in
running:healthy|running)
echo "✅ Coolify running"
finished|success)
echo "✅ Coolify deployment finished"
exit 0
;;
exited:unhealthy|exited|failed|error)
echo "❌ Coolify status: $STATUS"
failed|error|cancelled)
echo "❌ Coolify deployment status: $STATUS"
echo "Panel: ${{ secrets.COOLIFY_BASE_URL }}"
exit 1
;;
@@ -229,7 +242,7 @@ jobs:
sleep $INTERVAL
done
echo "⚠️ Timeout — Coolify status hala '$STATUS' — public URL health check'e geçiliyor"
echo "⚠️ Timeout — deployment hala '$STATUS' (10 dk geçti) — public URL health check'e geçiliyor"
- name: Public URL health check
run: |