fix(ci): use container status check to avoid transient 404 during restart
CI/CD / deploy (push) Successful in 54s Details

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Jeff Emmett 2026-04-01 14:31:57 -07:00
parent 4abd1f2f88
commit 6008deefa3
1 changed files with 7 additions and 6 deletions

View File

@ -49,11 +49,13 @@ jobs:
- name: Smoke test
run: |
sleep 30
HTTP_CODE=$(ssh -o StrictHostKeyChecking=no -i ~/.ssh/deploy_key root@${{ secrets.DEPLOY_HOST }} \
"curl -sSL -o /dev/null -w '%{http_code}' --max-time 30 https://ebb-staging.jeffemmett.com/ 2>/dev/null || echo 000")
if [ "$HTTP_CODE" -lt 200 ] || [ "$HTTP_CODE" -ge 400 ]; then
echo "Smoke test failed (HTTP $HTTP_CODE) — rolling back"
sleep 15
STATUS=$(ssh -o StrictHostKeyChecking=no -i ~/.ssh/deploy_key root@${{ secrets.DEPLOY_HOST }} \
"cd /opt/websites/ebb-n-flow-website && docker compose ps --format '{{.Status}}' 2>/dev/null | head -1 || echo 'unknown'")
if echo "$STATUS" | grep -qi "up"; then
echo "Smoke test passed (container status: $STATUS)"
else
echo "Smoke test failed (container status: $STATUS) — rolling back"
ROLLBACK_TAG=$(ssh -o StrictHostKeyChecking=no -i ~/.ssh/deploy_key root@${{ secrets.DEPLOY_HOST }} "cat /opt/websites/ebb-n-flow-website/.rollback-tag 2>/dev/null")
if [ -n "$ROLLBACK_TAG" ]; then
ssh -o StrictHostKeyChecking=no -i ~/.ssh/deploy_key root@${{ secrets.DEPLOY_HOST }} \
@ -62,4 +64,3 @@ jobs:
fi
exit 1
fi
echo "Smoke test passed (HTTP $HTTP_CODE)"