fix(ci): use container status check instead of HTTP (domain returns 404)
CI/CD / deploy (push) Successful in 1m15s Details

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Jeff Emmett 2026-04-01 14:31:53 -07:00
parent e09d791a55
commit 820f2ba1ae
1 changed files with 6 additions and 5 deletions

View File

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