This project demonstrates a complete CI/CD pipeline using:
- Jenkins Master + Jenkins Agent (builds run on agent)
- Maven (build + test)
- SonarQube (static code analysis + quality gate)
- Docker (image build + push to DockerHub)
- Trivy (container image vulnerability scan)
- AWS EKS (Kubernetes cluster)
- ArgoCD (GitOps deployment from manifest repo)
- Slack / Email notification (after CD)
- Developer pushes code to GitHub Application Repository
- Jenkins CI pipeline triggers
- Jenkins pulls source code
- Build artifact using Maven
- Run Maven tests
- Run SonarQube analysis
- Wait for Quality Gate
- Build Docker image
- Push Docker image to DockerHub
- Run Trivy scan on Docker image
- Cleanup workspace/artifacts
- Trigger Jenkins CD pipeline
- Jenkins CD pipeline triggers automatically
- CD job updates image tag (build number) inside
deployment.yaml - CD job commits & pushes updated manifest to GitOps repository
- ArgoCD detects updated manifest from GitHub
- ArgoCD deploys resources to EKS
- Send notification via Slack / Email
- AWS Account
- GitHub account (2 repos)
- DockerHub account (with access token)
- Jenkins Master VM (Ubuntu)
- Jenkins Agent VM (Ubuntu, Docker installed)
- SonarQube VM (Ubuntu + PostgreSQL)
- EKS cluster (created using
eksctl) - ArgoCD installed on EKS
- (Optional) Slack webhook or Email SMTP configured in Jenkins
You will maintain two repositories:
Contains:
- Application source code
Jenkinsfile(CI pipeline)
Contains:
- Kubernetes manifests (
deployment.yaml,service.yaml, etc.) Jenkinsfile(CD pipeline)
- Open inbound port 8080
- Install:
- Java
- Jenkins
- Install:
- Java
- Docker
- Add docker permissions:
sudo usermod -aG docker ubuntu
- Configure SSH key auth between master → agent
- Add node in Jenkins via SSH using private key
- Open inbound port 9000
- Install:
- PostgreSQL
- Java (Adoptium)
- SonarQube
- Configure:
- DB credentials in
sonar.properties - SonarQube systemd service
- DB credentials in
Install:
- AWS CLI
- kubectl
- eksctl
Create EKS cluster using:
eksctl create cluster ...
- Create namespace
argocd - Install ArgoCD manifests
- Expose ArgoCD service using LoadBalancer
- Login and update admin password
- Add EKS cluster into ArgoCD
- Connect GitOps repo to ArgoCD
- Maven Integration
- Pipeline Maven Integration
- Eclipse Temurin Installer
- SonarQube Scanner
- Sonar Quality Gates / Quality Gates
- Docker
- Docker Commons
- Docker Pipeline
- Docker API
- Docker Build Step
- CloudBees Docker Build and Publish
Go to: Manage Jenkins → Tools
- Maven:
- Name:
Maven3 - Install automatically ✅
- Name:
- JDK:
- Name:
Java17 - Install automatically ✅
- Install from Adoptium (example: 17.0.5+8)
- Name:
- Sonar Scanner:
- Name:
SonarQubeScanner - Install automatically ✅
- Name:
Go to: Manage Jenkins → Credentials
- Kind: Username with password
- ID:
github - Username:
<your_github_username> - Password:
<github_personal_access_token>
- Kind: Username with password
- ID:
dockerhub - Username:
<your_dockerhub_username> - Password:
<dockerhub_access_token>
- Kind: Secret text
- ID:
jenkins-sonarqube-token - Secret:
<sonarqube_generated_token>
- Kind: Secret text
- ID:
jenkins-api-token - Secret:
<jenkins_user_api_token>
Go to: Manage Jenkins → System → SonarQube servers
- Name:
SonarQubeServer - URL:
http://<sonarqube_private_ip>:9000 - Authentication token:
jenkins-sonarqube-token
In SonarQube: Administration → Configuration → Webhooks → Create
Webhook URL example:
http://<jenkins_master_ip>:8080/sonarqube-webhook/
Without this webhook, the quality gate stage may fail.
Your CI Jenkinsfile typically includes stages:
- Cleanup workspace
- Checkout SCM
- Build (mvn clean package)
- Test (mvn test)
- SonarQube Analysis
- Quality Gate
- Build & Push Docker Image
- Trivy Scan
- Cleanup artifacts
- Trigger CD pipeline (remote trigger)
Update names like agent label, tool names, credential IDs to match your Jenkins.
Your CD Jenkinsfile typically includes stages:
- Cleanup workspace
- Checkout SCM
- Update image tag in
deployment.yaml - Commit and push changes back to GitOps repo
The CD job is configured to accept a parameter:
IMAGE_TAG(string)
In ArgoCD:
- Create new app
- Project:
default - Sync Policy: Automatic
- Enable:
- Prune resources ✅
- Self Heal ✅
- Source:
- Repo URL: GitOps repo
- Path:
./
- Destination:
- Cluster: Your EKS cluster
- Namespace:
default
ArgoCD will continuously apply the latest deployment.yaml from GitHub.
In Jenkins CI job: Build Triggers
- Poll SCM:
* * * * *(every minute)
So any push to GitHub triggers CI automatically.
- Modify a file in application repo (ex:
index.jsp) - Push to GitHub
- Jenkins CI triggers automatically
- Docker image is pushed with new build tag
- CI triggers CD pipeline
- CD updates GitOps
deployment.yamlimage tag - ArgoCD syncs and deploys to EKS
- Confirm:
kubectl get podskubectl get svc- App is accessible via LoadBalancer DNS