fix: deploy.sh status polling - tolerate build transition

This commit is contained in:
TenX PM
2026-05-04 16:08:44 +00:00
parent 2c0c4e34c2
commit 4330e0d65e
+7 -2
View File
@@ -173,21 +173,26 @@ curl -sk -X POST -H "Authorization: Bearer ${COOLIFY_ACCESS_TOKEN}" \
# ── Step 8: Wait for deployment ──────────────────────────────────────
echo "[deploy] Waiting for deployment..."
sleep 15
FAIL_COUNT=0
for i in $(seq 1 30); do
sleep 10
STATUS=$(curl -sk -H "Authorization: Bearer ${COOLIFY_ACCESS_TOKEN}" \
"${COOLIFY_API}/applications/${APP_UUID}" | python3 -c "import sys,json; print(json.load(sys.stdin).get('status','unknown'))" 2>/dev/null)
echo "[deploy] Status: ${STATUS} (attempt ${i}/30)"
if [ "${STATUS}" = "running" ]; then
if [[ "${STATUS}" == running* ]]; then
echo "[deploy] App is running!"
break
fi
if [[ "${STATUS}" == exited* ]] || [ "${STATUS}" = "error" ]; then
FAIL_COUNT=$((FAIL_COUNT + 1))
if [ "${FAIL_COUNT}" -ge 3 ]; then
echo "[deploy] Deployment failed with status: ${STATUS}"
# Get logs
curl -sk -H "Authorization: Bearer ${COOLIFY_ACCESS_TOKEN}" \
"${COOLIFY_API}/applications/${APP_UUID}/logs" 2>/dev/null | tail -20
exit 1
fi
fi
done
# ── Step 9: Get the URL ──────────────────────────────────────────────