Skip to content

feat(argocd-wait-sync-multi): emit previousRevision per app - #333

Closed
JesperTerkelsen wants to merge 1 commit into
mainfrom
feat/wait-sync-multi-previous-revision
Closed

feat(argocd-wait-sync-multi): emit previousRevision per app#333
JesperTerkelsen wants to merge 1 commit into
mainfrom
feat/wait-sync-multi-previous-revision

Conversation

@JesperTerkelsen

Copy link
Copy Markdown
Member

What

Adds a previousRevision field to each entry of the deployments output, so downstream changelogs can show a per-system revert target ("what was live before this deploy") — the thing you reach for during an incident.

Output schema is now:

[{ "name", "app", "revision", "previousRevision", "start", "end", "status", "url" }]

How

previousRevision is extracted from the app's own .status.history — the most recent history revision that differs from the revision we just verified (a "last distinct" filter, so a same-SHA re-sync doesn't report itself as its own previous). It honours the same source-repo source-index selection as revision, since multi-source history entries mirror .status.sync.revisions[] ordering.

  • No extra API calls — reuses the app JSON the state machine already fetches each poll.
  • Timing-robust — captured the first time we lock onto our revision, and the "differs from verified" filter is correct whether or not ArgoCD has appended the new history entry yet.
  • Empty on a first-ever deploy (no prior distinct revision).

Why this shape

Sourced from ArgoCD sync history rather than a git diff so it reflects what ArgoCD actually had synced before, not what a manifests PR intended — that's the accurate revert target.

Verified

bash test/run-tests.sh — green (5/5). Test A now asserts the multi-source app with history reports previousRevision = the prior revisions[0], and the app with no history reports previousRevision: "".

Follow-up

Consumed by changelog-cli (DeployedSystem.previousRevision → a grey "Containers (N)" card rendering previous → new with a compare link per system).

Adds a previousRevision field to each entry of the deployments output,
sourced from the app's .status.history — the most recent history revision
that differs from the one just verified (honoring source-repo indexing for
multi-source apps). This gives downstream changelogs the revert target for
each deployed system. Empty on a first-ever deploy.
@JesperTerkelsen

Copy link
Copy Markdown
Member Author

Closing: superseded by a different source for the previous version. We're reading the previous image tag straight from monorepo-typescript-manifests at bump time (consistent with how the single-service deploy already does it via component-deploy.yml), rather than from ArgoCD sync history. The manifests read yields the app image tag (the version humans read + a real code compare link), whereas .status.history gives the manifests commit SHA. Keeping argocd-wait-sync-multi a pure rollout-verifier (timing/status/url); the version identity is joined in downstream.

@JesperTerkelsen
JesperTerkelsen deleted the feat/wait-sync-multi-previous-revision branch August 27, 2026 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant