CI/CD Integration

In a GitOps workflow, CI and CD have clear jobs. CI builds, tests, and publishes artifacts. CD is the GitOps controller (ArgoCD or Flux) reconciling the cluster from Git. These guides show how to wire popular CI systems without turning the pipeline into a push-based deployer.

CI vs GitOps CD

StageOwnsTypical actions
CIPipelineLint, test, build image, scan, push to registry
Git updateCI (or bot)Bump image tag / digest in manifests or values, open or push a commit
CDGitOps controllerDetect Git change, sync, report health, self-heal drift
graph LR A[Push / PR] --> B[CI pipeline] B --> C[Build & test] C --> D[Push image] D --> E[Update Git manifests] E --> F[ArgoCD / Flux] F --> G[Kubernetes]

The important rule: the cluster should change because Git changed, not because CI ran kubectl apply. That keeps audit trail, rollback, and drift detection in one place.

What CI should and should not do

Do in CI

  • Build and push immutable images (prefer digests)
  • Run unit, integration, and policy checks
  • Update desired state in Git (tag, digest, or values)
  • Optionally open a PR for human approval on sensitive envs

Avoid in CI (for GitOps CD)

  • Direct kubectl apply / helm upgrade to production as the main path
  • Cluster credentials in every pipeline when a controller already has them
  • Skipping Git so “hotfixes” only exist on the cluster

For promotion strategies after the Git update, see Environment promotion.

What you’ll learn

GuideWhat it covers
GitHub ActionsWorkflows that build, push, and commit manifest updates for ArgoCD or Flux
GitLab CIPipeline stages for the same GitOps handoff with GitLab runners

Suggested path

  1. Clarify ownership — Confirm CD is ArgoCD or Flux before writing deploy jobs.
  2. Implement one pipeline — Start with GitHub Actions or GitLab CI for a single app.
  3. Align the repo — Match CI path updates to your repository structure.

FAQ

Can CI still deploy to a cluster?
Yes for break-glass or non-GitOps environments—but for GitOps production paths, prefer updating Git and letting the controller sync.

Who writes the manifest update—CI or image automation?
Either. CI often commits the new tag after a build. Flux image automation can watch the registry and commit instead. Pick one primary path per app to avoid races.

Do I need separate repos for app code and manifests?
Common and recommended for access control. CI in the app repo can open a PR or push to the config repo via a deploy key or machine user.