This repository demonstrates an end-to-end CI/CD pipeline using Jenkins, Docker, GitHub, Kubernetes and Argo CD (Operator-based).
CI/CD Β· GitOps Β· Release Management Β· Docker Image Versioning . Kubernetes Deployments Β· Argo CD Sync Β· Jenkins Pipelines
- Source Control: GitHub
- CI Tool: Jenkins (Declarative Pipeline)
- Build Tool: Maven
- Containerization: Docker
- CD Tool: Argo CD (Installed via Operator & Controllers)
- Deployment: Kubernetes
| Repository | Purpose | URL |
|---|---|---|
myFirstProject |
Spring Boot application source code | https://github.com/3034saurabhkumar/myFirstProject |
CI-CD_implementation |
Kubernetes manifests (deployment.yml, service.yml) |
https://github.com/3034saurabhkumar/CI-CD_implementation |
Developer Commit
β
GitHub (Release Branch)
β
Jenkins Pipeline
β
Maven Build
β
Docker Image Build & Push
β
Update Deployment Repo
β
Argo CD Sync
β
Kubernetes Deployment
- Cleans old workspace
- Fresh Git checkout
- Creates
release-<version>branch - Pushes to GitHub using credentials
- Runs
mvn clean package - Generates JAR
- Stashes build artifact
- Builds Docker image using JAR
- Pushes image to Docker Hub
- Image tag = release version
- Clones
CI-CD_implementation - Updates Docker image tag in
deployment.yml - Commits & pushes changes to
main
- Argo CD detects Git change
- Automatically syncs to Kubernetes cluster
| Credential ID | Type | Usage |
|---|---|---|
github-release-creds |
Username + Token | GitHub push & branch creation |
docker-cred |
Docker Registry | Docker image push |
saurabh3034/spring-voldemort:<release-version>
Example
saurabh3034/spring-voldemort:1.0.1
- Installed using Argo CD Operator
- CRDs and Controllers installed first
- Application configuration:
- Repository:
CI-CD_implementation - Branch:
main - Path:
/
- Repository:
- Sync Policy: Automated
ββββββββββββββ
β Developer β
β Git Push β
βββββββ¬βββββββ
β
βΌ
ββββββββββββββββββββββββββ
β GitHub β App Repo β
β myFirstProject β
β (release-x.y.z branch) β
βββββββ¬βββββββββββββββββββ
β
βΌ
ββββββββββββββββββββββββββ
β Jenkins CI β
β------------------------β
β β’ Maven Build β
β β’ Docker Image Build β
β β’ Push to Docker Hub β
β β’ Update Deploy Repo β
βββββββ¬βββββββββββββββββββ
β
βΌ
ββββββββββββββββββββββββββ
β GitHub β Deploy Repo β
β CI-CD_implementation β
β (deployment.yml) β
βββββββ¬βββββββββββββββββββ
β
βΌ
ββββββββββββββββββββββββββ
β Argo CD (Operator) β
β GitOps Sync Controller β
βββββββ¬βββββββββββββββββββ
β
βΌ
ββββββββββββββββββββββββββ
β Kubernetes Cluster β
β Spring Boot App β
ββββββββββββββββββββββββββ
The pipeline follows a release-based CI model with GitOps-driven CD, ensuring traceability, versioning, and automated Kubernetes deployments.
- Cleans Jenkins workspace
- Performs fresh SCM checkout
Why?
- Prevents stale artifacts
- Ensures reproducible builds
- Jenkins creates
release-<version>branch - Pushes branch to GitHub using stored credentials
Why?
- Each release is immutable and traceable
- Enables safe rollback
- Uses official
mavenDocker image - Builds Spring Boot JAR
- Stashes artifact for later stages
Why?
- Tool isolation
- No dependency on Jenkins host setup
- Unstashes JAR
- Builds Docker image
- Tags image with release version
- Pushes image to Docker Hub
Why?
- Immutable versioned images
- Environment consistency
- Jenkins updates
deployment.yml - Replaces image tag with release version
- Commits changes to deployment repository
Why?
- Git becomes the single source of truth
- Enables GitOps
- Argo CD watches deployment repo
- Detects Git changes
- Syncs Kubernetes automatically
Why?
- No direct
kubectl apply - Safe, auditable deployments
- Manual trigger or Git push
- Provide parameter:
RELEASE_VERSION=1.0.1
- Creates branch:
release-1.0.1 - Builds JAR
- Builds Docker image:
saurabh3034/spring-voldemort:1.0.1 - Pushes image to Docker Hub
Before:
image: saurabh3034/spring-voldemort:replaceImageTag
After:
image: saurabh3034/spring-voldemort:1.0.1
Committed to:
CI-CD_implementation/main
- Detects Git commit
- Syncs Kubernetes manifests
- Performs rolling update
- Old pods terminated
- New pods created
- Zero or minimal downtime
β
Git Revert (Recommended):
git revert <commit-id>
- Argo CD automatically rolls back the deployment.
β Image Rollback:
- Change image tag to previous version and commit.
- Jenkins credentials store for secrets
- No hardcoded tokens
- Dockerized build environments
- GitOps-based deployment control
- Immutable artifacts
π§ One-Line Summary
βI implemented a Jenkins-based CI pipeline with GitOps-driven CD using Argo CD, enabling secure, versioned, and fully automated Kubernetes deployments.β
- Every release triggers:
- Create Release branch
- New Docker image build
- Push Docker image on DockerHub
- Updated Kubernetes manifests
- Automatic deployment via Argo CD
- Branch Strategy
- Artifact sharing in Jenkins (
stash / unstash) - Secure GitHub authentication
- Multi-repository CI/CD
- GitOps using Argo CD
- Operator-based Argo CD installation
- Helm charts
- Image scanning (Trivy)
- Manual approval gates
- Slack notifications
- Ingress with TLS