fix(ci): use container status check instead of HTTP (domain returns 404)
CI/CD / deploy (push) Successful in 1m15s
Details
CI/CD / deploy (push) Successful in 1m15s
Details
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
e09d791a55
commit
820f2ba1ae
|
|
@ -52,10 +52,12 @@ jobs:
|
|||
- name: Smoke test
|
||||
run: |
|
||||
sleep 15
|
||||
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://conviction.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"
|
||||
STATUS=$(ssh -o StrictHostKeyChecking=no -i ~/.ssh/deploy_key root@${{ secrets.DEPLOY_HOST }} \
|
||||
"cd /opt/websites/conviction-voting-demo && 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/conviction-voting-demo/.rollback-tag 2>/dev/null")
|
||||
if [ -n "$ROLLBACK_TAG" ]; then
|
||||
ssh -o StrictHostKeyChecking=no -i ~/.ssh/deploy_key root@${{ secrets.DEPLOY_HOST }} \
|
||||
|
|
@ -64,4 +66,3 @@ jobs:
|
|||
fi
|
||||
exit 1
|
||||
fi
|
||||
echo "Smoke test passed (HTTP $HTTP_CODE)"
|
||||
|
|
|
|||
Loading…
Reference in New Issue