diff --git a/.github/workflows/daily-e2e-health.yaml b/.github/workflows/daily-e2e-health.yaml index 482ed792..4088ee1d 100644 --- a/.github/workflows/daily-e2e-health.yaml +++ b/.github/workflows/daily-e2e-health.yaml @@ -104,9 +104,9 @@ jobs: echo "🔍 Ping VIP ($VIP_IP)..." ping -c 2 "$VIP_IP" || echo "⚠️ Ping failed (may be blocked)" - # 嘗試連線 + # 嘗試連線 (正確路徑: /api/v1/health) echo "🔗 Curl health endpoint..." - HTTP_CODE=$(curl -s -o /tmp/health_response.txt -w "%{http_code}" --connect-timeout 15 "$API_URL/health" || echo "000") + HTTP_CODE=$(curl -s -o /tmp/health_response.txt -w "%{http_code}" --connect-timeout 15 "$API_URL/api/v1/health" || echo "000") if [ "$HTTP_CODE" = "200" ]; then echo "✅ API 可用: $API_URL (HTTP $HTTP_CODE)" @@ -116,12 +116,18 @@ jobs: echo "📋 Response:" cat /tmp/health_response.txt 2>/dev/null || echo "(empty)" - # 嘗試備用端點 - FALLBACK_URL="http://192.168.0.120:32334" + # 嘗試備用端點 (node 121 直連) + FALLBACK_URL="http://192.168.0.121:32334" echo "🔄 嘗試備用端點: $FALLBACK_URL" - FALLBACK_CODE=$(curl -s -o /dev/null -w "%{http_code}" --connect-timeout 10 "$FALLBACK_URL/health" || echo "000") + FALLBACK_CODE=$(curl -s -o /tmp/fallback_response.txt -w "%{http_code}" --connect-timeout 10 "$FALLBACK_URL/api/v1/health" || echo "000") echo " 備用結果: HTTP $FALLBACK_CODE" + if [ "$FALLBACK_CODE" = "200" ]; then + echo "✅ 備用端點可用,VIP 可能有問題" + cat /tmp/fallback_response.txt + exit 0 # 備用成功,不算失敗 + fi + exit 1 fi