chore: silence curl stderr in browser-e2e to handle transition 502/503 during deploy
This commit is contained in:
@@ -41,13 +41,14 @@ jobs:
|
|||||||
set -e
|
set -e
|
||||||
EXPECTED_VERSION="$(git rev-parse --short HEAD)"
|
EXPECTED_VERSION="$(git rev-parse --short HEAD)"
|
||||||
for i in $(seq 1 60); do
|
for i in $(seq 1 60); do
|
||||||
VERSION_BODY="$(curl -fsS "http://${DEPLOY_HOST}/taxbaik/version.txt" || true)"
|
# Suppress stderr and allow failures to handle transition/down periods cleanly
|
||||||
|
VERSION_BODY="$(curl -fsS "http://${DEPLOY_HOST}/taxbaik/version.txt" 2>/dev/null || true)"
|
||||||
BLOG_STATUS="$(curl -s -o /dev/null -w '%{http_code}' "http://${DEPLOY_HOST}/taxbaik/blog/accountant-mistakes-5" || true)"
|
BLOG_STATUS="$(curl -s -o /dev/null -w '%{http_code}' "http://${DEPLOY_HOST}/taxbaik/blog/accountant-mistakes-5" || true)"
|
||||||
if echo "$VERSION_BODY" | grep -q "Version: ${EXPECTED_VERSION}" && [ "$BLOG_STATUS" = "200" ]; then
|
if echo "$VERSION_BODY" | grep -q "Version: ${EXPECTED_VERSION}" && [ "$BLOG_STATUS" = "200" ]; then
|
||||||
echo "Deployment is ready for ${EXPECTED_VERSION}"
|
echo "Deployment is ready for ${EXPECTED_VERSION}"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
echo "Waiting for deployment ${EXPECTED_VERSION}; blog status=${BLOG_STATUS}; version=${VERSION_BODY}"
|
echo "Waiting for deployment ${EXPECTED_VERSION} (attempt $i/60); blog status=${BLOG_STATUS:-down}; version=${VERSION_BODY:-unknown}"
|
||||||
sleep 10
|
sleep 10
|
||||||
done
|
done
|
||||||
echo "Deployment did not publish expected version ${EXPECTED_VERSION} in time" >&2
|
echo "Deployment did not publish expected version ${EXPECTED_VERSION} in time" >&2
|
||||||
|
|||||||
Reference in New Issue
Block a user