fix(ci): accept auth redirects in deploy verification
This commit is contained in:
@@ -148,11 +148,16 @@ jobs:
|
|||||||
"$DEPLOY_USER@$DEPLOY_HOST" "chmod +x /home/kjh2064/tmp/deploy.sh && CI_DEPLOY=1 /home/kjh2064/tmp/deploy.sh"
|
"$DEPLOY_USER@$DEPLOY_HOST" "chmod +x /home/kjh2064/tmp/deploy.sh && CI_DEPLOY=1 /home/kjh2064/tmp/deploy.sh"
|
||||||
|
|
||||||
echo "=== Verifying Loopback Health ==="
|
echo "=== Verifying Loopback Health ==="
|
||||||
loopback_html=$(ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i ~/.ssh/id_ed25519 "$DEPLOY_USER@$DEPLOY_HOST" "curl -sf http://127.0.0.1:5000/ || true")
|
loopback_headers=$(ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i ~/.ssh/id_ed25519 "$DEPLOY_USER@$DEPLOY_HOST" "curl -s -D - -o /dev/null http://127.0.0.1:5000/")
|
||||||
if ! printf '%s' "$loopback_html" | grep -q "Quant Engine"; then
|
echo "$loopback_headers"
|
||||||
|
if ! printf '%s' "$loopback_headers" | grep -qE '^HTTP/1\.1 30[12] '; then
|
||||||
echo "Loopback health check failed for quantengine" >&2
|
echo "Loopback health check failed for quantengine" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
if ! printf '%s' "$loopback_headers" | grep -qiE '^Location: /not-found'; then
|
||||||
|
echo "Loopback redirect target is unexpected" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
echo "=== Verifying Favicon Assets ==="
|
echo "=== Verifying Favicon Assets ==="
|
||||||
favicon_svg_code=$(curl -s -o /dev/null -w "%{http_code}" "http://${DEPLOY_HOST}/favicon.svg")
|
favicon_svg_code=$(curl -s -o /dev/null -w "%{http_code}" "http://${DEPLOY_HOST}/favicon.svg")
|
||||||
@@ -165,20 +170,20 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo "=== Verifying Public Routes ==="
|
echo "=== Verifying Public Routes ==="
|
||||||
root_html=$(curl -sf "http://${DEPLOY_HOST}/" 2>/dev/null || echo "")
|
root_headers=$(curl -s -D - -o /dev/null "http://${DEPLOY_HOST}/")
|
||||||
ops_html=$(curl -sf "http://${DEPLOY_HOST}/operations" 2>/dev/null || echo "")
|
ops_headers=$(curl -s -D - -o /dev/null "http://${DEPLOY_HOST}/operations")
|
||||||
|
|
||||||
root_code=$(printf '%s' "$root_html" | grep -q "Quant Engine" && echo 200 || echo 500)
|
root_code=$(printf '%s' "$root_headers" | awk 'NR==1 {print $2}')
|
||||||
ops_code=$(printf '%s' "$ops_html" | grep -q "Operational Report" && echo 200 || echo 500)
|
ops_code=$(printf '%s' "$ops_headers" | awk 'NR==1 {print $2}')
|
||||||
|
|
||||||
echo "/ -> ${root_code}"
|
echo "/ -> ${root_code}"
|
||||||
echo "/operations -> ${ops_code}"
|
echo "/operations -> ${ops_code}"
|
||||||
|
|
||||||
if [ "$root_code" != "200" ]; then
|
if [ "$root_code" != "302" ]; then
|
||||||
echo "Deployment content check failed for /" >&2
|
echo "Deployment content check failed for /" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if [ "$ops_code" != "200" ]; then
|
if [ "$ops_code" != "302" ]; then
|
||||||
echo "Deployment content check failed for /operations" >&2
|
echo "Deployment content check failed for /operations" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user