feat: Substitui a validação JSON com jq por grep no workflow de deploy e aprimora a mensagem de tentativa de reexecução.

This commit is contained in:
Rodrigo Borba 2026-01-25 14:32:42 -03:00
parent a7bf570815
commit f05f308f53

View File

@ -29,19 +29,20 @@ jobs:
status_code=$(echo $response | head -n 1) status_code=$(echo $response | head -n 1)
if [ $status_code -eq 200 ]; then if [ $status_code -eq 200 ]; then
body=$(curl -s https://chatwoot-pr-${{ github.event.pull_request.number }}.herokuapp.com/api) body=$(curl -s https://chatwoot-pr-${{ github.event.pull_request.number }}.herokuapp.com/api)
if echo "$body" | jq -e '.version and .timestamp and .queue_services == "ok" and .data_services == "ok"' > /dev/null; then # Check for required fields using grep to avoid jq dependency on self-hosted runners
if echo "$body" | grep -q '"version"' && echo "$body" | grep -q '"timestamp"' && echo "$body" | grep -q '"queue_services":"ok"' && echo "$body" | grep -q '"data_services":"ok"'; then
echo "Deployment successful" echo "Deployment successful"
exit 0 exit 0
else else
echo "Deployment status healthy but services not ready, retrying in 30 seconds..." echo "Deployment status healthy but services not ready, retrying in 30 seconds... (Attempt $attempt/$max_attempts)"
sleep 30 sleep 30
attempt=$((attempt + 1))
fi fi
else else
echo "Waiting for review app to be ready, retrying in 30 seconds... (Attempt $attempt/$max_attempts)" echo "Waiting for review app to be ready, retrying in 30 seconds... (Attempt $attempt/$max_attempts)"
sleep 30 sleep 30
attempt=$((attempt + 1)) attempt=$((attempt + 1))
fi fi
done done
echo "Deployment check timed out after $max_attempts attempts" echo "Deployment check timed out after $max_attempts attempts"
exit 1 exit 1
fi