CI: fix smoke test to follow redirects and accept 2xx/3xx
CI/CD / deploy (push) Successful in 1m8s
Details
CI/CD / deploy (push) Successful in 1m8s
Details
Also increases sleep to 15s and timeout to 30s for slower containers. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
7be3c75d79
commit
9335c0a4ce
|
|
@ -51,15 +51,16 @@ jobs:
|
||||||
|
|
||||||
- name: Smoke test
|
- name: Smoke test
|
||||||
run: |
|
run: |
|
||||||
sleep 10
|
sleep 15
|
||||||
HTTP_CODE=$(curl -sS -o /dev/null -w "%{http_code}" --max-time 15 https://jefflix.lol/ 2>/dev/null || echo "000")
|
HTTP_CODE=$(curl -sSL -o /dev/null -w "%{http_code}" --max-time 30 https://jefflix.lol/ 2>/dev/null || echo "000")
|
||||||
if [ "$HTTP_CODE" != "200" ]; then
|
if [ "$HTTP_CODE" -lt 200 ] || [ "$HTTP_CODE" -ge 400 ]; then
|
||||||
echo "Smoke test failed — rolling back"
|
echo "Smoke test failed (HTTP $HTTP_CODE) — rolling back"
|
||||||
ROLLBACK_TAG=$(ssh -o StrictHostKeyChecking=no -i ~/.ssh/deploy_key root@${{ secrets.DEPLOY_HOST }} "cat /opt/websites/jefflix-website/.rollback-tag 2>/dev/null")
|
ROLLBACK_TAG=$(ssh -o StrictHostKeyChecking=no -i ~/.ssh/deploy_key root@${{ secrets.DEPLOY_HOST }} "cat /opt/websites/jefflix-website/.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 }} \
|
||||||
"cd /opt/websites/jefflix-website && IMAGE_TAG=$ROLLBACK_TAG docker compose up -d --no-build"
|
"cd /opt/websites/jefflix-website && IMAGE_TAG=$ROLLBACK_TAG docker compose up -d --no-build"
|
||||||
|
echo "Rolled back to $ROLLBACK_TAG"
|
||||||
fi
|
fi
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo "Smoke test passed"
|
echo "Smoke test passed (HTTP $HTTP_CODE)"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue