fix(ci): use container status check instead of HTTP (domain returns 404)
CI/CD / deploy (push) Successful in 1m16s
Details
CI/CD / deploy (push) Successful in 1m16s
Details
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
18e2074b43
commit
155d0aba6b
|
|
@ -53,10 +53,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://demo.rtube.online/ 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/apps/rtube-online && docker compose ps --format '{{.Status}}' rtube 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/apps/rtube-online/.rollback-tag 2>/dev/null")
|
||||
if [ -n "$ROLLBACK_TAG" ]; then
|
||||
ssh -o StrictHostKeyChecking=no -i ~/.ssh/deploy_key root@${{ secrets.DEPLOY_HOST }} \
|
||||
|
|
@ -65,4 +67,3 @@ jobs:
|
|||
fi
|
||||
exit 1
|
||||
fi
|
||||
echo "Smoke test passed (HTTP $HTTP_CODE)"
|
||||
|
|
|
|||
Loading…
Reference in New Issue