Repository navigation
Description
Pre-submission checklist
- I have searched existing issues and confirmed this is not a duplicate.
- I understand that submitting a feature request does not guarantee it will be implemented.
Proposed Feature
When the argocd-update step builds the Argo CD Operation for an Application, it should carry the Application's spec.syncPolicy.automated.prune over into operation.sync.prune — and/or accept an explicit per-app/per-step prune option in step config.
Today the operation is built with neither (pkg/promotion/runner/builtin/argocd_updater.go, main @ 0f529f20, identical in v1.10.7):
app.Operation = &argocd.Operation{
InitiatedBy: argocd.OperationInitiator{
Username: actor,
Automated: automated,
},
Info: []*argocd.Info{
{
Name: "Reason",
Value: "Promotion triggered a sync of this Application resource.",
},
{
Name: promotionInfoKey,
Value: stepCtx.Promotion,
},
},
Sync: &argocd.SyncOperation{
Revisions: []string{},
},
}
if app.Spec.SyncPolicy != nil {
if app.Spec.SyncPolicy.Retry != nil {
app.Operation.Retry = *app.Spec.SyncPolicy.Retry
}
if app.Spec.SyncPolicy.SyncOptions != nil {
app.Operation.Sync.SyncOptions = app.Spec.SyncPolicy.SyncOptions
}
}syncPolicy.retry and syncPolicy.syncOptions are copied; syncPolicy.automated.prune is not (there is no prune occurrence in the whole file), so operation.sync.prune is never set and every Kargo-initiated sync runs with prune disabled.
This cannot be worked around from the Application side: Argo CD's Prune is not a sync option — it exists only as a field on the sync operation, or as syncPolicy.automated.prune, which is consulted when Argo CD itself builds an auto-sync operation, not when a third party posts one. That was already confirmed upthread in #2984.
Motivation and Use Case
We hit this in production (Kargo chart 1.10.7, 2026-11-18). A chart release legitimately stopped rendering a previously-tracked Secret (moved to External Secrets). The Application has syncPolicy.automated.prune: true, and Kargo's argocd-update step drives every sync. The result was not just "the orphan lingers" — the app wedged permanently:
- The removed Secret became a prune candidate. On every Kargo-initiated sync its resource task came back
PruneSkipped("ignored (requires pruning)"), so the entire sync failed with "one or more synchronization tasks completed unsuccessfully (retried 5 times)", and the promotion then errored on the step timeout. - Argo CD's own auto-sync — the only path that would prune, since the app declares
automated.prune: true— then refused to run for that revision+source:alreadyAttemptedSync(controller/appcontroller.go) matches the previously-failed operation for the same revisions and logs "Skipping auto-sync: failed previous sync attempt ... will not retry". - No subsequent Kargo promotion can clear the wedge: each one re-posts a prune-less operation that fails identically. 109 resources stayed OutOfSync for ~12h (the rest of the release — collector Deployments, frontend — never rolled) until we manually changed
app.spec.source(an inert Helm parameter) to breakalreadyAttemptedSync's source comparison and let Argo CD's own prune-capable auto-sync fire.
So for any Application that (a) declares syncPolicy.automated.prune: true and (b) is driven by a Kargo stage, ANY change that removes a tracked template — a rename, a move-to-ESO, a deletion — bricks the app at that revision until a human intervenes. Applications with auto-sync disabled get the milder variant that motivated #2984: orphans linger forever.
Notably, in #2984 @jessesuen said of copying the Application's sync policy into the operation: "Actually, I already assumed we were doing that, so we should make that change." The retry and syncOptions halves of that change landed; the prune half did not. Honoring syncPolicy.automated.prune needs no new step config and matches exactly what Argo CD's own auto-sync path does when it builds an operation.
Alternatives Considered
- Per-app/per-step
pruneoption on the step (feat(argocd): add prune option to argocd-update step #6837) — closed in favor of a futureargocd-syncstep (Simplerargocd-syncstep #6028). Even if explicit per-sync flags ultimately live there, honoring the Application's own standingautomated.prunepreference insideargocd-updateis orthogonal (it's not a per-sync override — it's parity with what the app already declared) and would fix this wedge class for every existing user with no config changes. argocd.argoproj.io/sync-options: Prune=falseon the orphaned resource — keeps the orphan forever (the deletion never happens) and requires predicting the orphan in advance; not a real remedy.- Manual re-arm runbook — change
spec.sourceonce so auto-sync re-fires, or a one-timeargocd app sync --prune --resource ':<Kind>:<name>'. This is what we do today; the point of this issue is that it shouldn't take a human.
Activity