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
+11 -6
View File
@@ -173,20 +173,25 @@ curl -sk -X POST -H "Authorization: Bearer ${COOLIFY_ACCESS_TOKEN}" \
# ── Step 8: Wait for deployment ────────────────────────────────────── # ── Step 8: Wait for deployment ──────────────────────────────────────
echo "[deploy] Waiting for deployment..." echo "[deploy] Waiting for deployment..."
sleep 15
FAIL_COUNT=0
for i in $(seq 1 30); do for i in $(seq 1 30); do
sleep 10 sleep 10
STATUS=$(curl -sk -H "Authorization: Bearer ${COOLIFY_ACCESS_TOKEN}" \ 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) "${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)" echo "[deploy] Status: ${STATUS} (attempt ${i}/30)"
if [ "${STATUS}" = "running" ]; then if [[ "${STATUS}" == running* ]]; then
echo "[deploy] App is running!"
break break
fi fi
if [[ "${STATUS}" == exited* ]] || [ "${STATUS}" = "error" ]; then if [[ "${STATUS}" == exited* ]] || [ "${STATUS}" = "error" ]; then
echo "[deploy] Deployment failed with status: ${STATUS}" FAIL_COUNT=$((FAIL_COUNT + 1))
# Get logs if [ "${FAIL_COUNT}" -ge 3 ]; then
curl -sk -H "Authorization: Bearer ${COOLIFY_ACCESS_TOKEN}" \ echo "[deploy] Deployment failed with status: ${STATUS}"
"${COOLIFY_API}/applications/${APP_UUID}/logs" 2>/dev/null | tail -20 curl -sk -H "Authorization: Bearer ${COOLIFY_ACCESS_TOKEN}" \
exit 1 "${COOLIFY_API}/applications/${APP_UUID}/logs" 2>/dev/null | tail -20
exit 1
fi
fi fi
done done