argocd app sync: Usage, Options & Common CI Errors
Force Argo CD to reconcile an application to its desired Git state.
argocd app sync tells Argo CD to apply an application’s target manifests to the cluster now, rather than waiting for the next auto-sync. In CI you log in with a token, sync, and wait for health.
What it does
argocd app sync <app> triggers a synchronization: Argo CD compares the live cluster state against the desired state from Git and applies the difference. With --prune it deletes resources no longer in Git; with --wait (or a follow-up argocd app wait) it blocks until the app is Synced and Healthy.
Common usage
# Log in non-interactively, then sync an app
argocd login argocd.example.com --username admin --password "$ARGOCD_PASSWORD" --grpc-web
argocd app sync myapp
# CI: sync, prune removed resources, and wait for health
argocd app sync myapp --prune
argocd app wait myapp --health --timeout 300Common error in CI: login required / app stays OutOfSync
sync fails with "rpc error: code = Unauthenticated" (no session) or the app reports "OutOfSync"/"SyncFailed" because a manifest is invalid or a resource is immutable. Fix: authenticate first with argocd login --username/--password or --auth-token "$ARGOCD_AUTH_TOKEN" (add --grpc-web behind ingress), then sync. For a persistent SyncFailed, read argocd app get <app> for the failing resource and message - often an immutable field requiring --replace or a bad manifest in Git to correct.
Key options
| Option | Purpose |
|---|---|
| <app> | Application to sync |
| --prune | Delete resources removed from Git |
| --force | Force apply (replace) |
| --timeout N | Sync timeout in seconds |
| --revision REV | Sync to a specific Git revision |