Add comprehensive deployment verification
- Health endpoint polling with retry loop - API check (GET /api/v1/projects returns 200) - Frontend check (HTML is served) - Clear output with section headers
This commit is contained in:
@@ -91,19 +91,48 @@ deploy_feature:
|
|||||||
- echo "Waiting for deployment to be ready..."
|
- echo "Waiting for deployment to be ready..."
|
||||||
- kubectl rollout status deployment/orchard-$CI_COMMIT_REF_SLUG -n $NAMESPACE --timeout=5m
|
- kubectl rollout status deployment/orchard-$CI_COMMIT_REF_SLUG -n $NAMESPACE --timeout=5m
|
||||||
- |
|
- |
|
||||||
echo "Waiting for health endpoint (certs may take a few minutes)..."
|
BASE_URL="https://orchard-$CI_COMMIT_REF_SLUG.common.global.bsf.tools"
|
||||||
HEALTH_URL="https://orchard-$CI_COMMIT_REF_SLUG.common.global.bsf.tools/health"
|
|
||||||
|
echo "=== Waiting for health endpoint (certs may take a few minutes) ==="
|
||||||
for i in $(seq 1 30); do
|
for i in $(seq 1 30); do
|
||||||
if curl -sf --max-time 10 "$HEALTH_URL" > /dev/null 2>&1; then
|
if curl -sf --max-time 10 "$BASE_URL/health" > /dev/null 2>&1; then
|
||||||
echo "Health check passed!"
|
echo "Health check passed!"
|
||||||
curl -s "$HEALTH_URL" | head -c 200
|
break
|
||||||
exit 0
|
|
||||||
fi
|
fi
|
||||||
echo "Attempt $i/30 - waiting 10s..."
|
echo "Attempt $i/30 - waiting 10s..."
|
||||||
sleep 10
|
sleep 10
|
||||||
done
|
done
|
||||||
echo "Health check failed after 5 minutes"
|
|
||||||
exit 1
|
# Verify health endpoint
|
||||||
|
echo ""
|
||||||
|
echo "=== Health Check ==="
|
||||||
|
curl -sf "$BASE_URL/health" || { echo "Health check failed"; exit 1; }
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# Verify API is responding
|
||||||
|
echo ""
|
||||||
|
echo "=== API Check (GET /api/v1/projects) ==="
|
||||||
|
HTTP_CODE=$(curl -sf -o /dev/null -w "%{http_code}" "$BASE_URL/api/v1/projects")
|
||||||
|
if [ "$HTTP_CODE" = "200" ]; then
|
||||||
|
echo "API responding: HTTP $HTTP_CODE"
|
||||||
|
else
|
||||||
|
echo "API check failed: HTTP $HTTP_CODE"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Verify frontend is served
|
||||||
|
echo ""
|
||||||
|
echo "=== Frontend Check ==="
|
||||||
|
if curl -sf "$BASE_URL/" | grep -q "</html>"; then
|
||||||
|
echo "Frontend is being served"
|
||||||
|
else
|
||||||
|
echo "Frontend check failed"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "=== All checks passed! ==="
|
||||||
|
echo "Deployment URL: $BASE_URL"
|
||||||
environment:
|
environment:
|
||||||
name: review/$CI_COMMIT_REF_SLUG
|
name: review/$CI_COMMIT_REF_SLUG
|
||||||
url: https://orchard-$CI_COMMIT_REF_SLUG.common.global.bsf.tools
|
url: https://orchard-$CI_COMMIT_REF_SLUG.common.global.bsf.tools
|
||||||
|
|||||||
Reference in New Issue
Block a user