Skip to content

Commit 991ed1f

Browse files
committed
✨ Exit successfully when all CRITICAL apps healthy
- Added early exit (EXIT POINT 2a) when all CRITICAL apps are Healthy + Synced - Allows OPTIONAL apps (observability, kiali, ollama) to be Progressing - Unblocks CI - no need to wait for optional apps - Typical exit time: 5-10 minutes instead of 60 minute timeout
1 parent 674d333 commit 991ed1f

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

scripts/monitor-argocd-apps.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -671,6 +671,33 @@ while [ $(($(date +%s) - MONITOR_START)) -lt $MONITOR_TIMEOUT ]; do
671671
fi
672672
done
673673

674+
# Success: All CRITICAL apps healthy (allow optional apps to be progressing)
675+
if [ $CRITICAL_TOTAL -gt 0 ] && [ "$CRITICAL_HEALTHY" -eq "$CRITICAL_TOTAL" ]; then
676+
# Check if all critical apps are also synced
677+
CRITICAL_SYNCED=0
678+
while read -r app_line; do
679+
app_name=$(echo "$app_line" | jq -r '.metadata.name')
680+
sync_status=$(echo "$app_line" | jq -r '.status.sync.status // "Unknown"')
681+
682+
if is_critical_app "$app_name"; then
683+
[ "$sync_status" = "Synced" ] && CRITICAL_SYNCED=$((CRITICAL_SYNCED + 1))
684+
fi
685+
done < <(echo "$ALL_APPS" | jq -c '.items[]')
686+
687+
if [ "$CRITICAL_SYNCED" -eq "$CRITICAL_TOTAL" ]; then
688+
echo ""
689+
echo -e "${GREEN}✅ All CRITICAL applications are healthy and synced!${NC}"
690+
echo "Total time: ${ELAPSED}s ($(($ELAPSED / 60))m)"
691+
echo ""
692+
echo -e "${CYAN}[EXIT POINT 2a] Exiting with code 0 (SUCCESS - CRITICAL APPS HEALTHY)${NC}"
693+
echo -e "${CYAN}Reason: All ${CRITICAL_TOTAL} CRITICAL apps are Healthy and Synced${NC}"
694+
echo -e "${CYAN}Optional apps: ${OPTIONAL_HEALTHY}/${OPTIONAL_TOTAL} Healthy (may still be Progressing)${NC}"
695+
echo -e "${CYAN}Elapsed time: ${ELAPSED}s / Timeout: ${MONITOR_TIMEOUT}s${NC}"
696+
echo ""
697+
exit 0
698+
fi
699+
fi
700+
674701
# Success: All apps healthy and synced
675702
if [ "$TOTAL_APPS" -gt 0 ] && [ "$HEALTHY_APPS" -eq "$TOTAL_APPS" ] && [ "$SYNCED_APPS" -eq "$TOTAL_APPS" ]; then
676703
echo ""

0 commit comments

Comments
 (0)