GitOps With Jenkins: Jenkins for CI and Argo CD for CD, Updating Manifests and Image Tags in Git

CI CD Pipelines with Jenkins 35 min min read Updated: Nov 17, 2026 Advanced
GitOps With Jenkins: Jenkins for CI and Argo CD for CD, Updating Manifests and Image Tags in Git
Advanced Topic 3 of 3

Push vs Pull Deployment

Push (Jenkins deploys)Pull (GitOps)
Who changes the clusterJenkins runs kubectl or helm with cluster credentialsAn agent inside the cluster (Argo CD or Flux) pulls from Git and applies it
Cluster credentialsStored in Jenkins (a big target)Stay in the cluster. Jenkins never holds them
Source of truthThe last pipeline runGit: you can read exactly what should be running
DriftManual changes stay unnoticedDetected and, if enabled, corrected automatically
RollbackRe-run a pipelinegit revert
AuditJenkins logsGit history: who, what, when and the review

The Split

text APP repo (code) CONFIG repo (manifests / Helm values per environment) │ push ▲ Jenkins commits the new image tag ▼ │ JENKINS: build ─ test ─ scan ─ push image ─┘ │ (Git change) ▼ ARGO CD in the cluster: sees the change ─► syncs ─► health check Jenkins = CI. Argo CD = CD.
  • The application repository holds source code and the Jenkinsfile
  • The config repository holds Kubernetes YAML, Kustomize overlays or Helm values for dev, staging and prod
  • Separate repositories mean app builds do not trigger on config changes, and permissions can differ

Config Repository Layout

text shop-config/ ├─ base/ │ ├─ deployment.yaml │ ├─ service.yaml │ └─ kustomization.yaml └─ overlays/ ├─ dev/ kustomization.yaml (images: newTag: 128-3f9c2ab) ├─ staging/ kustomization.yaml └─ prod/ kustomization.yaml
yaml # overlays/dev/kustomization.yaml apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: - ../../base namespace: shop-dev images: - name: registry.example.com/team/shop newTag: "127-a1b2c3d"

Jenkins Updates the Tag in Git

groovy stage('Update config repo') { when { branch 'main' } steps { withCredentials([usernamePassword(credentialsId: 'config-repo-bot', usernameVariable: 'GIT_USER', passwordVariable: 'GIT_PASS')]) { sh ''' set -e rm -rf config && git clone https://${GIT_USER}:${GIT_PASS}@git.example.com/team/shop-config.git config cd config/overlays/dev kustomize edit set image registry.example.com/team/shop=registry.example.com/team/shop:${TAG} git config user.name "jenkins-bot" git config user.email "jenkins-bot@example.com" git add kustomization.yaml git commit -m "dev: shop ${TAG} (build ${BUILD_NUMBER}, commit ${GIT_COMMIT})" || echo "nothing to commit" git push origin HEAD:main ''' } } }
Safer: open a pull request: For staging and production, have Jenkins push a branch and open a pull request (use the GitHub CLI gh pr create). A person reviews and merges, which is the approval. The merge triggers Argo CD.
bash git checkout -b promote-staging-${TAG} kustomize edit set image registry.example.com/team/shop=registry.example.com/team/shop:${TAG} git commit -am "staging: shop ${TAG}" && git push -u origin HEAD gh pr create --title "Promote shop ${TAG} to staging" --body "Build ${BUILD_URL}. Tests passed. Scan clean." --base mai

Argo CD Application

yaml apiVersion: argoproj.io/v1alpha1 kind: Application metadata: name: shop-dev namespace: argocd spec: project: shop source: repoURL: https://git.example.com/team/shop-config.git targetRevision: main path: overlays/dev destination: server: https://kubernetes.default.svc namespace: shop-dev syncPolicy: automated: {prune: true, selfHeal: true} # dev: auto-sync; prod: leave manual or use PR gate syncOptions: [CreateNamespace=true]

Wait for the Result in Jenkins (Optional)

groovy stage('Wait for Argo CD') { steps { withCredentials([string(credentialsId: 'argocd-token', variable: 'ARGOCD_AUTH_TOKEN')]) { sh ''' argocd --server argocd.example.com --grpc-web app sync shop-dev --revision main argocd --server argocd.example.com --grpc-web app wait shop-dev --health --timeout 300 ''' } } }

Benefits and Costs

BenefitsCosts
Cluster credentials never leave the clusterTwo repositories and one more tool to learn
Git is the audit trail and the rollback toolDeployment result is not in the Jenkins job unless you add a wait step
Automatic drift correctionSecrets need a GitOps-friendly approach (Sealed Secrets, External Secrets, SOPS)
Easy to rebuild a cluster from GitNeeds discipline: no manual kubectl edit in production

Practice Tasks

  1. Create an app repo and a config repo with Kustomize overlays
  2. Write the Jenkins stage that updates the dev overlay tag and pushes it
  3. Install Argo CD in a lab cluster and create the Application
  4. Make staging promotion a pull request created by Jenkins
  5. Roll back a bad release with git revert and watch the cluster follow

Conclusion

In GitOps, Jenkins stays the CI engine: build, test, scan, push the image and commit the new tag to a config repository. Argo CD or Flux inside the cluster pulls and applies it, so cluster credentials stay inside, Git is the audit trail and rollback is a revert. Use pull requests for staging and production promotion.

Quick Summary: push vs pull; app repo vs config repo; kustomize edit set image from Jenkins; PR promotion; Argo CD Application; wait step; benefits/costs.

Get Newsletter

Subscibe to our newsletter and we will notify you about the newest updates on Edugators