Fix workflow validation by polling inside container
Build and Validate / build-and-test (push) Failing after 16s

This commit is contained in:
2026-04-21 08:48:05 -04:00
parent 82d610a3ec
commit 972677b7f6
+15 -8
View File
@@ -22,14 +22,21 @@ jobs:
- name: Validate web application loads - name: Validate web application loads
run: | run: |
HTTP_STATUS=$(curl -o /dev/null -s -w "%{http_code}\n" http://localhost:4567/) echo "Waiting for application to start..."
if [ "$HTTP_STATUS" -ne 200 ]; then for i in {1..15}; do
echo "Failed to load web application. HTTP status: $HTTP_STATUS" # Run curl inside the container to bypass any host-runner networking port mapping quirks
docker logs todoizer HTTP_STATUS=$(docker exec todoizer curl -o /dev/null -s -w "%{http_code}\n" http://localhost:4567/ || echo "failed")
exit 1 if [ "$HTTP_STATUS" == "200" ]; then
else echo "Web application loaded successfully. HTTP status: $HTTP_STATUS"
echo "Web application loaded successfully. HTTP status: $HTTP_STATUS" exit 0
fi fi
echo "Attempt $i: App not ready (Status: $HTTP_STATUS). Sleeping 2s..."
sleep 2
done
echo "Failed to load web application after 30 seconds."
docker logs todoizer
exit 1
- name: Cleanup Test Container - name: Cleanup Test Container
if: always() if: always()