fix(healthcheck): accept 404 for /docs in production health check
CI/CD Pipeline / Dedup Check - skip PR tests when covered by push pipeline (pull_request) Successful in 2s
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 2s
CI/CD Pipeline / PR Build API Image (pull_request) Successful in 19s
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 26s
AI Code Review / AI Code Review (pull_request) Successful in 58s
PR Automation / Auto Merge on CI Green + Approved (pull_request) Successful in 1m11s
CI/CD Pipeline / Validate - Python (mypy + alembic) (pull_request) Successful in 2m6s
CI/CD Pipeline / Integration Tests (pull_request) Successful in 2m4s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 2m24s
CI/CD Pipeline / Validate - Style (pull_request) Successful in 2m39s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 2m55s
CI/CD Pipeline / Validate - Security (pull_request) Successful in 6m38s
CI/CD Pipeline / Unit Tests (pull_request) Successful in 7m20s
CI/CD Pipeline / Deploy Production (pull_request) Has been skipped
CI/CD Pipeline / Production Browser E2E (pull_request) Has been skipped
CI/CD Pipeline / CI Gate (pull_request) Successful in 1s
ACR Cleanup / ACR Image Cleanup (pull_request_target) Successful in 11s
Preview Cleanup / Cleanup Preview Environment (pull_request) Successful in 36s
CI/CD Pipeline / Canary Release to Production (pull_request) Failing after 311h52m58s
CI/CD Pipeline / Build Production Worker Image (pull_request) Failing after 311h53m1s
CI/CD Pipeline / Build Production API Image (pull_request) Failing after 311h53m1s
CI/CD Pipeline / ACR Image Cleanup (pull_request) Failing after 311h59m13s
CI/CD Pipeline / Retag skipped Staging Worker Image (pull_request) Failing after 311h59m23s
CI/CD Pipeline / Staging API Integration Tests (pull_request) Failing after 311h59m14s
CI/CD Pipeline / Retag skipped Staging Web Image (pull_request) Failing after 311h59m24s
CI/CD Pipeline / Staging E2E Tests (pull_request) Failing after 311h59m15s
CI/CD Pipeline / Build Staging API Image (pull_request) Failing after 311h59m32s
CI/CD Pipeline / Retag skipped Staging API Image (pull_request) Failing after 311h59m24s
CI/CD Pipeline / PR Build Web Image (pull_request) Failing after 311h59m59s
CI/CD Pipeline / Build Staging Worker Image (pull_request) Failing after 311h59m30s
CI/CD Pipeline / Frontend Lint (pull_request) Failing after 312h0m19s
CI/CD Pipeline / Check push changed paths (pull_request) Failing after 312h0m25s
CI/CD Pipeline / Build Production Web Image (pull_request) Failing after 312h27m23s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Failing after 312h33m38s
CI/CD Pipeline / Build Staging Web Image (pull_request) Failing after 312h33m53s
CI/CD Pipeline / Frontend Unit Tests (pull_request) Failing after 312h34m40s

Production sets docs_url=None in main.py (FastAPI), so /docs returns 404.
The health check now treats 404 as healthy (API is responding,
just docs are disabled). 200 still passes for staging/other envs.
This commit is contained in:
2026-09-03 15:24:20 +08:00
parent ec45d71d2c
commit f7307842f1
+3 -3
View File
@@ -160,11 +160,11 @@ health_check() {
web_ok=true
fi
# 检查 API docs
# 检查 API docs(生产环境禁用 /docs,404 表示 API 在正常响应,视为健康)
if [ "$api_docs_ok" = false ]; then
HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" --max-time 10 "${PROD_API_URL}/docs" 2>/dev/null || echo "000")
if [ "$HTTP_CODE" = "200" ]; then
log_info "✅ API Docs 检查通过"
if [ "$HTTP_CODE" = "200" ] || [ "$HTTP_CODE" = "404" ]; then
log_info "✅ API Docs 检查通过(HTTP $HTTP_CODE)"
api_docs_ok=true
fi
fi