diff --git a/.readthedocs.yaml b/.readthedocs.yaml index c1029af694..1dabec70ba 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -9,44 +9,7 @@ build: python: "3.12" jobs: post_checkout: - - | - if [ "$READTHEDOCS_VERSION_TYPE" = "external" ]; then - MAX_WAIT=300 - INTERVAL=60 - ELAPSED=0 - while :; do - RAW=$(curl -sS -w "\n%{http_code}" "https://api.github.com/repos/vllm-project/vllm/commits/${READTHEDOCS_GIT_COMMIT_HASH}/check-runs?check_name=pre-run-check&filter=latest") - HTTP_CODE=$(printf %s "$RAW" | tail -n1) - BODY=$(printf %s "$RAW" | head -n -1) - if [ "$HTTP_CODE" != "200" ]; then - echo "GitHub API returned HTTP $HTTP_CODE (likely rate-limited); skipping pre-run-check gate." - break - fi - STATUS=$(printf %s "$BODY" | python3 -c "import sys, json; r=json.load(sys.stdin).get(\"check_runs\",[]); print((r[0].get(\"status\") or \"\") if r else \"none\")") - CONCLUSION=$(printf %s "$BODY" | python3 -c "import sys, json; r=json.load(sys.stdin).get(\"check_runs\",[]); print((r[0].get(\"conclusion\") or \"\") if r else \"\")") - if [ "$STATUS" = "none" ]; then - echo "no pre-run-check found for this commit; skipping gate." - break - fi - if [ -n "$CONCLUSION" ]; then - echo "pre-run-check conclusion: $CONCLUSION" - if [ "$CONCLUSION" = "failure" ] || [ "$CONCLUSION" = "cancelled" ] || [ "$CONCLUSION" = "timed_out" ]; then - echo "pre-run-check did not pass; failing docs build." - exit 1 - fi - break - fi - if [ "$ELAPSED" -ge "$MAX_WAIT" ]; then - echo "pre-run-check status=$STATUS after ${MAX_WAIT}s; skipping gate." - break - fi - echo "pre-run-check status=$STATUS; waiting ${INTERVAL}s..." - sleep "$INTERVAL" - ELAPSED=$((ELAPSED + INTERVAL)) - done - else - echo "Not a PR build (version type=$READTHEDOCS_VERSION_TYPE); skipping pre-run-check gate." - fi + - bash docs/pre_run_check.sh - git fetch origin main --unshallow --no-tags --filter=blob:none || true pre_create_environment: - pip install uv diff --git a/docs/pre_run_check.sh b/docs/pre_run_check.sh new file mode 100644 index 0000000000..de93f82faf --- /dev/null +++ b/docs/pre_run_check.sh @@ -0,0 +1,41 @@ +if [ "$READTHEDOCS_VERSION_TYPE" = "external" ]; then + MAX_WAIT=300 + INTERVAL=60 + ELAPSED=0 + while :; do + RAW=$(curl -sS -w "\n%{http_code}" "https://api.github.com/repos/vllm-project/vllm/commits/${READTHEDOCS_GIT_COMMIT_HASH}/check-runs?check_name=pre-run-check&filter=latest") + HTTP_CODE=$(printf %s "$RAW" | tail -n1) + BODY=$(printf %s "$RAW" | sed '$d') + if [ "$HTTP_CODE" != "200" ]; then + echo "GitHub API returned HTTP $HTTP_CODE (likely rate-limited); skipping pre-run-check gate." + break + fi + STATUS=$(printf %s "$BODY" | python3 -c "import sys, json; r=json.load(sys.stdin).get(\"check_runs\",[]); print((r[0].get(\"status\") or \"\") if r else \"none\")") + CONCLUSION=$(printf %s "$BODY" | python3 -c "import sys, json; r=json.load(sys.stdin).get(\"check_runs\",[]); print((r[0].get(\"conclusion\") or \"\") if r else \"\")") + CHECK_URL=$(printf %s "$BODY" | python3 -c "import sys, json; r=json.load(sys.stdin).get(\"check_runs\",[]); print((r[0].get(\"html_url\") or \"\") if r else \"\")") + if [ "$STATUS" = "none" ]; then + echo "no pre-run-check found for this commit; skipping gate." + break + fi + if [ -n "$CONCLUSION" ]; then + echo "pre-run-check conclusion: $CONCLUSION" + if [ "$CONCLUSION" = "failure" ] || [ "$CONCLUSION" = "cancelled" ] || [ "$CONCLUSION" = "timed_out" ]; then + echo "pre-run-check did not pass; skipping docs build." + if [ -n "$CHECK_URL" ]; then + echo "pre-run-check failure reason: $CHECK_URL" + fi + exit 1 + fi + break + fi + if [ "$ELAPSED" -ge "$MAX_WAIT" ]; then + echo "pre-run-check status=$STATUS after ${MAX_WAIT}s; skipping gate." + break + fi + echo "pre-run-check status=$STATUS; waiting ${INTERVAL}s..." + sleep "$INTERVAL" + ELAPSED=$((ELAPSED + INTERVAL)) + done +else + echo "Not a PR build (version type=$READTHEDOCS_VERSION_TYPE); skipping pre-run-check gate." +fi \ No newline at end of file