ci: the deploy health check must follow redirects
jecreativ.ro's first production deploy went red for behaving exactly as configured: it runs in UnderConstruction mode, so `/` correctly answers 302 to the placeholder, and the check asserted a bare 200. Now `-L` follows the redirect and the FINAL code is asserted. A redirect means the app is up and routing, which is what this step is for; a real failure (502, 500, refused) still reports. The version gate itself was right throughout -- it read 1bafc14 from the production host, including through the under-construction middleware. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WpTYCBLH58XzrM7n3xPJ5N
This commit is contained in:
@@ -169,10 +169,15 @@ jobs:
|
|||||||
staging) HOST=192.168.1.111 ;;
|
staging) HOST=192.168.1.111 ;;
|
||||||
production) HOST=192.168.1.101 ;;
|
production) HOST=192.168.1.101 ;;
|
||||||
esac
|
esac
|
||||||
|
# `-L` follows redirects and we assert on the FINAL code, because a 302 from `/`
|
||||||
|
# is a healthy answer for a site running in UnderConstruction mode -- it means the
|
||||||
|
# app is up and routing. Asserting a bare 200 failed jecreativ.ro's first
|
||||||
|
# production deploy for doing exactly what it was configured to do.
|
||||||
|
#
|
||||||
# `|| CODE=000` for the same reason as above: curl exiting non-zero on a
|
# `|| CODE=000` for the same reason as above: curl exiting non-zero on a
|
||||||
# connection failure must produce a reportable code, not kill the step before
|
# connection failure must produce a reportable code, not kill the step before
|
||||||
# it can say what went wrong. (`-s` without `-f` already tolerates 4xx/5xx.)
|
# it can say what went wrong. (`-s` without `-f` already tolerates 4xx/5xx.)
|
||||||
CODE=$(curl -s -o /dev/null -w '%{http_code}' -m 20 "http://${HOST}:${WEB_PORT}/") || CODE=000
|
CODE=$(curl -sL -o /dev/null -w '%{http_code}' -m 20 "http://${HOST}:${WEB_PORT}/") || CODE=000
|
||||||
if [ "${CODE}" != "200" ]; then
|
if [ "${CODE}" != "200" ]; then
|
||||||
echo "::error::Home page returned ${CODE}."
|
echo "::error::Home page returned ${CODE}."
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
Reference in New Issue
Block a user