Interview Prep/GitOps & Argo CD/Sync Behaviour, Waves & Hooks

A new release needs a database migration that must finish before the new pods start. How do you implement it in Argo CD?

IntermediateScenarioSync Behaviour, Waves & Hooks
Answer

Situation read → Ordered, blocking step before the main apply.

What I'd do →

  1. Add a Job with argocd.argoproj.io/hook: PreSync and hook-delete-policy: BeforeHookCreation, using the same image tag as the release.
  2. Set backoffLimit: 1 and activeDeadlineSeconds so it fails fast.
  3. Write the migration to be backward compatible (expand now, contract in a later release).
  4. Add a SyncFail hook to alert the team.

Why → PreSync blocks the rollout on migration failure, keeping the old version running.

Interview tip → Mention expand/contract, because old pods keep running during the rollout.

All GitOps & Argo CD questions Roadmap: Argo CD (GitOps)

More on Sync Behaviour, Waves & Hooks