From 0f3339e977412fc380fee55e76fb9e40a3ae7e34 Mon Sep 17 00:00:00 2001 From: OG T Date: Sun, 29 Mar 2026 20:21:52 +0800 Subject: [PATCH] =?UTF-8?q?fix(ci):=20E2E=20health=20check=20=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E7=B6=B2=E8=B7=AF=E8=A8=BA=E6=96=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 增加 ping VIP 診斷 - 增加備用端點 (direct 120) fallback - 增加 HTTP 狀態碼和回應內容輸出 - 改善錯誤訊息,方便除錯 Co-Authored-By: Claude Opus 4.5 --- .github/workflows/daily-e2e-health.yaml | 28 ++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/.github/workflows/daily-e2e-health.yaml b/.github/workflows/daily-e2e-health.yaml index e45fee1c..61d7f30c 100644 --- a/.github/workflows/daily-e2e-health.yaml +++ b/.github/workflows/daily-e2e-health.yaml @@ -73,10 +73,32 @@ jobs: run: | API_URL="${{ github.event.inputs.api_url || env.DEFAULT_API_URL }}" echo "🔗 檢查 API 健康狀態..." - if curl -s --connect-timeout 10 "$API_URL/health" > /dev/null; then - echo "✅ API 可用: $API_URL" + echo "📍 Runner: $(hostname)" + echo "🌐 Target: $API_URL" + + # 診斷網路連通性 + VIP_IP=$(echo "$API_URL" | sed -E 's|https?://([^:]+).*|\1|') + echo "🔍 Ping VIP ($VIP_IP)..." + ping -c 2 "$VIP_IP" || echo "⚠️ Ping failed (may be blocked)" + + # 嘗試連線 + echo "🔗 Curl health endpoint..." + HTTP_CODE=$(curl -s -o /tmp/health_response.txt -w "%{http_code}" --connect-timeout 15 "$API_URL/health" || echo "000") + + if [ "$HTTP_CODE" = "200" ]; then + echo "✅ API 可用: $API_URL (HTTP $HTTP_CODE)" + cat /tmp/health_response.txt else - echo "❌ API 無法連線: $API_URL" + echo "❌ API 無法連線: $API_URL (HTTP $HTTP_CODE)" + echo "📋 Response:" + cat /tmp/health_response.txt 2>/dev/null || echo "(empty)" + + # 嘗試備用端點 + FALLBACK_URL="http://192.168.0.120:32334" + echo "🔄 嘗試備用端點: $FALLBACK_URL" + FALLBACK_CODE=$(curl -s -o /dev/null -w "%{http_code}" --connect-timeout 10 "$FALLBACK_URL/health" || echo "000") + echo " 備用結果: HTTP $FALLBACK_CODE" + exit 1 fi