Skip to content

Commit 6dea27e

Browse files
authored
fix(docs-noob-tester): replace STATUS=$(curl) with until curl to survive set -e (#28624)
1 parent 3dc60a7 commit 6dea27e

2 files changed

Lines changed: 32 additions & 18 deletions

File tree

.github/workflows/docs-noob-tester.lock.yml

Lines changed: 14 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/docs-noob-tester.md

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,25 @@ pre-agent-steps:
5050
echo "Server PID: $PID"
5151
- name: Wait for server readiness
5252
run: |
53-
for i in {1..45}; do # 45 attempts × 3s = 135s max wait
54-
STATUS=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:4321/gh-aw/)
55-
[ "$STATUS" = "200" ] && echo "Server ready at http://localhost:4321/gh-aw/!" && break
56-
echo "Waiting for server... ($i/45) (status: $STATUS)" && sleep 3
53+
MAX_WAIT=135 # 45 attempts × 3s = 135s max wait
54+
WAITED=0
55+
until curl -sf http://localhost:4321/gh-aw/ > /dev/null 2>&1; do
56+
# Check if the server process has already died
57+
if [ -f /tmp/server.pid ] && ! kill -0 "$(cat /tmp/server.pid)" 2>/dev/null; then
58+
echo "::error::Documentation server process died before becoming ready. Server log:"
59+
cat /tmp/preview.log
60+
exit 1
61+
fi
62+
WAITED=$((WAITED + 3))
63+
if [ $WAITED -ge $MAX_WAIT ]; then
64+
echo "::error::Documentation server did not start after ${MAX_WAIT}s. Server log:"
65+
cat /tmp/preview.log
66+
exit 1
67+
fi
68+
echo "Waiting for server... ($WAITED/${MAX_WAIT}s)"
69+
sleep 3
5770
done
71+
echo "Server ready at http://localhost:4321/gh-aw/!"
5872
- name: Detect bridge IP and write server URL
5973
run: |
6074
SERVER_IP=$(ip -4 route get 1.1.1.1 2>/dev/null | awk '{print $7; exit}')

0 commit comments

Comments
 (0)