Skip to content
LatchkeyLatchkey home

argocd app rollback: Revert to a Prior Sync

argocd app rollback redeploys a previous revision of an Application using an entry from its deployment history.

When a deploy goes bad, rollback re-syncs the Application to a known-good history ID without needing to revert Git first.

What it does

argocd app rollback re-applies a Application to a previous revision identified by a history ID from argocd app history. It performs a sync to that stored revision. Rollback is blocked while auto-sync is enabled, since auto-sync would immediately re-apply Git.

Common usage

Terminal
argocd app history guestbook
# roll back to history ID 3
argocd app rollback guestbook 3
argocd app wait guestbook --health --timeout 300

Options

FlagWhat it does
<APPNAME> <ID>Application name and history ID to roll back to
--prunePrune resources during the rollback sync
--timeout <sec>Fail if the rollback sync does not finish in time

In CI

List IDs with argocd app history first; the ID is the deployment number, not a Git SHA. If the app uses automated sync you must disable it (argocd app set --sync-policy none) before rollback, then re-enable it once the Git fix lands.

Common errors in CI

"FATA[0000] rpc error: code = FailedPrecondition desc = Rollback is disabled for the app with automated sync enabled" means you must turn off auto-sync first. "application ... has no history" appears on an app that never synced. An out-of-range ID gives "history not found".

Using this in CI

A runner has no kubeconfig, no cached context, and no interactive auth. Every kubectl invocation in CI needs the context supplied explicitly, and most confusing CI failures here are the command running against the wrong cluster or no cluster at all.

Terminal
# never rely on the ambient context on a runner
kubectl --context "$KUBE_CONTEXT" -n "$NAMESPACE" get pods

# confirm what you are actually connected to before mutating anything
kubectl config current-context
kubectl cluster-info

# fail fast instead of hanging on an unreachable API server
kubectl --request-timeout=30s get nodes

Frequently asked questions

argocd app rollback: Revert to a Prior Sync?
When a deploy goes bad, rollback re-syncs the Application to a known-good history ID without needing to revert Git first.
What it does?
argocd app rollback re-applies a Application to a previous revision identified by a history ID from argocd app history. It performs a sync to that stored revision. Rollback is blocked while auto-sync is enabled, since auto-sync would immediately re-apply Git.
In CI?
List IDs with argocd app history first; the ID is the deployment number, not a Git SHA. If the app uses automated sync you must disable it (argocd app set --sync-policy none) before rollback, then re-enable it once the Git fix lands.
Common errors in CI?
"FATA[0000] rpc error: code = FailedPrecondition desc = Rollback is disabled for the app with automated sync enabled" means you must turn off auto-sync first. "application ... has no history" appears on an app that never synced. An out-of-range ID gives "history not found".

Related guides

References

Run this faster and cheaper on Latchkey managed runners - self-healing included. Start free → 30-day trial · No credit card