Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .github/actions/argocd-wait-sync-multi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,11 @@ commit — the same for every app in the run).
from your revision — or when the overall `timeout` elapses with any app not
yet healthy. Transient `Unknown` (≤30s) and `ComparisonError` (≤60s, with a
hard refresh) are tolerated.
- **Refresh first**: every app is refreshed up front so ArgoCD detects the new
revision immediately instead of on its next reconciliation.
- **Refresh first**: every app is refreshed up front, in parallel, so ArgoCD
detects the new revision immediately instead of on its next reconciliation.
- **Parallel polls**: each poll fetches every unfinished app's status in
parallel, so an app's `end` is accurate to one `poll-interval` however many
apps are waited on.
- **Supersede-aware**: if a newer bump moved an app past your revision, the
action confirms your commit is an ancestor (`compare … = ahead`) and treats it
as success (bundled).
Expand Down
16 changes: 14 additions & 2 deletions .github/actions/argocd-wait-sync-multi/wait-sync-multi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ done < <(echo "$APPS_JSON" | jq -r '.[] | [.app, .revision, (.name // .app)] | @

N=${#APP_NAMES[@]}

INFO_DIR=$(mktemp -d)
trap 'rm -rf "$INFO_DIR"' EXIT

# Per-app state. STATE ∈ pending | started | done
STATE=()
START_AT=() # ArgoCD operationState.startedAt (ISO)
Expand Down Expand Up @@ -168,8 +171,9 @@ fail_out() {

echo "Triggering ArgoCD refresh on all apps..."
for ((i = 0; i < N; i++)); do
refresh_app "${APP_NAMES[$i]}"
refresh_app "${APP_NAMES[$i]}" &
done
wait
echo ""

# --- main concurrent poll loop ----------------------------------------------
Expand All @@ -188,6 +192,14 @@ while true; do

ALL_DONE=true

# Fetched in parallel so each app's END_AT is accurate to one poll interval,
# not to a sequential sweep over every app.
for ((i = 0; i < N; i++)); do
[ "${STATE[$i]}" = "done" ] && continue
get_app_info "${APP_NAMES[$i]}" > "$INFO_DIR/$i.json" &
done
wait

for ((i = 0; i < N; i++)); do
[ "${STATE[$i]}" = "done" ] && continue
ALL_DONE=false
Expand All @@ -196,7 +208,7 @@ while true; do
expected="${EXPECTED_REVS[$i]}"
display="${DISPLAY_NAMES[$i]}"

info=$(get_app_info "$app")
info=$(cat "$INFO_DIR/$i.json")
sync_status=$(echo "$info" | jq -r '.status.sync.status // "Unknown"')
health_status=$(echo "$info" | jq -r '.status.health.status // "Unknown"')
op_phase=$(echo "$info" | jq -r '.status.operationState.phase // ""')
Expand Down
3 changes: 3 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
- **Latest SHA**: 84fb68d (check for newer commits)
- **Changes**: new `pnpm-dependency-submission.yml` and `pnpm-dependency-graph` action for pnpm 12 lockfiles

## Recent Changes (2026-11-12)
1. **`argocd-wait-sync-multi` refreshes and polls apps in parallel**: the initial refresh and each poll ran `argocd app get` once per app, one after another (~2.6 s each). With monorepo-typescript's 18 apps the refresh took ~47 s before the first poll, and a poll sweep 15-25 s, so an app's `end` was late by up to a sweep. Both now run every app's call in the background and `wait`; the per-app state machine then reads the fetched status from a temp dir, unchanged. Against a 1 s fake `argocd` with 10 already-healthy apps the script went from 23 s to 3 s. Offline tests unchanged and passing.

## Recent Changes (2026-11-09)
1. **Recovery pull request after a failed Terraform apply**: `terraform-stack.yml` takes an optional `recovery-token` secret. When an apply fails, it pushes `terraform-recover/<stack>` with the failed run's URL in `<stack>/recover.tf` and opens a draft pull request, so the leftover gets a normal reviewed plan and applies on merge. `command: recover` plans and applies unreviewed, which is what this replaces (monta-app/terraform#440). The branch is cut from the default branch only when no recovery pull request is open; otherwise the file is updated on the open one, so a fix pushed there is never reset. Commits go through the contents API, so no git credentials are needed on the runner. The token cannot be `GITHUB_TOKEN`: pull requests it opens never trigger workflows. Any successful apply of the stack closes the open recovery pull request. A missing reviewed plan fails before the apply step and still needs `recover`.

Expand Down