GitOpsFlux · Argo
Promote a release between environments with GitOps
A promotion propagates a change from the desired state of one stage to the desired state of the next, in the words of the Kargo documentation. When that state lives in Git, the change is a commit that can be reviewed, gated and reverted.

A directory for each environment
The Flux documentation calls this layout a monorepo: all Kubernetes manifests in one repository, with the configuration specific to each environment stored in the same branch.
├── apps
│ ├── base
│ ├── production
│ └── staging
├── infrastructure
│ ├── base
│ ├── production
│ └── staging
└── clusters
├── production
└── stagingThat tree is the Flux guide's own example, built on Kustomize overlays. Each cluster's state is defined in its own directory, such as clusters/production, which references the overlays for that environment.
Folders or branches for environments
Google Cloud's GitOps best practices for Config Sync say to use folders for variants of configuration, in place of branches. The page gives its reasons:
- With branches, you cannot tell whether the difference between a production and a development branch is an upcoming change or a permanent difference between the two environments.
- One change request can deploy to several clusters and namespaces, where branches require several change requests to different branches.
It also names the main downside: folders do not let you promote a change through a change request to the same files.
Two other official pages use a branch for each environment, for generated output. Argo CD's source hydrator, a beta feature, pushes hydrated manifests to a target branch such as environments/dev. The Kargo FAQ encourages stage-specific branches for the output of promotion processes, and calls a directory structure within a single branch equally tenable.
Promotion as a commit
The Flux guide manages promotion between environments through image updates written to Git. In a Kustomize overlay the value that changes is the image tag in the images field:
images:
- name: registry.example.com/my-app
- newTag: 1.4.1
+ newTag: 1.4.2The image name and the tags are for the example. For a chart, the value is the chart version: spec.chart.spec.version in a Flux HelmRelease, or targetRevision in an Argo CD Application whose source is a chart.
Automation
The Kustomize repository's image example shows a command for a pipeline: kustomize edit set image busybox=alpine:3.6 writes the images entry into the kustomization file. gh pr create opens a pull request, and its --base flag names the branch to merge into.
Three tools automate more of the work.
- Flux image automation. The image-reflector-controller scans image repositories, and the image-automation-controller updates YAML files and commits the changes to Git. The resources are
ImageRepository,ImagePolicyandImageUpdateAutomationatimage.toolkit.fluxcd.io/v1. These controllers are not installed by default. - Argo CD Image Updater. Since v1.0.0 it is configured with
ImageUpdatercustom resources. Its defaultargocdwrite-back method modifies the Application resource in the cluster, and thegitmethod creates a commit in the application's repository. Its documentation says the project is under active development and welcomes tests on non-critical environments. - Kargo. An open source project from Akuity. A Warehouse monitors repositories for new revisions of artifacts and packages them as Freight. Promotion steps include
kustomize-set-image,git-open-prandargocd-update. Kargo's processes do not perform deployments. A GitOps agent like Argo CD does that.
For a pull request with Flux, set .spec.git.push.branch, as in this snippet from the Flux guide:
kind: ImageUpdateAutomation
metadata:
name: flux-system
spec:
git:
checkout:
ref:
branch: main
push:
branch: flux-image-updatesThe guide says CI automation can then open a pull request against the checkout branch, so that you approve image updates before they are applied.
Gates between environments
The official pages describe these gates:
- Review and tests. The Flux guide merges a change to staging first and promotes it to production once the cluster is reconciled and passes conformance tests. It calls the process gated by pull request reviews and end-to-end testing.
- A staging branch. With
spec.sourceHydrator.hydrateTo, Argo CD pushes hydrated manifests to a separate branch and does not sync them until something moves them to the sync branch. - Verification. In Kargo, Freight that comes from an upstream Stage is available for promotion only after it has been verified there. Verification references one or more AnalysisTemplates and runs after each successful Promotion.
- Policy. A Kargo
ProjectConfigsets which Stages are eligible for automatic promotion, and promotion windows that gate when promotions may be created.
Rollback as a revert
Microsoft's GitOps guidance for AKS names the ability to roll back changes by performing Git operations, with a commit graph that still contains all commits.
git revert <commit>The Git documentation says git revert reverts the changes of existing commits and records new commits for it. To revert a merge commit, -m gives the parent number of the mainline. In a test repository, reverting the commit that set newTag: 1.4.2 restored newTag: 1.4.1 and left three commits in the log.
On the cluster side, the Flux FAQ says changes made with kubectl to an object Flux manages are undone at the next reconciliation. The Argo CD documentation says rollback cannot be performed against an application with automated sync enabled.
First steps
- Give each environment a folder on one branch, as in the Flux layout above.
- Open the first promotions as pull requests, so that review acts as the gate the Flux guide describes.
- Run
git reverton a test commit and read the log before you need it on a real promotion.
Sources
Want a second pair of eyes on yours? We do this work for a living.
More guides

Kustomize overlays: one base for many environments
GitOps · 3 min read
A base, an overlay for each environment, the fields to use and the deprecated ones to replace.

Secrets in GitOps: Sealed Secrets, SOPS or External Secrets Operator
GitOps · 4 min read
Sealed Secrets, SOPS and External Secrets Operator, with the documented facts for each side by side.

Helm charts: rules for charts you can maintain
GitOps · 4 min read
Documented values, a schema, shared helpers, CI checks and clean versioning for Helm charts.