This project implements a real-world DevSecOps CI/CD pipeline using a Jenkins Master–Agent architecture. It automates the complete software delivery lifecycle from GitHub code commit to build, test, code quality analysis, and deployment on a Tomcat server.
The system also includes infrastructure automation scripts for Jenkins setup, agent configuration, SSH communication, and automated deployment using Ansible.
This project simulates a production-like CI/CD pipeline that ensures:
- Automated build and testing
- Code quality enforcement (DevSecOps)
- Controlled and repeatable deployments
- Infrastructure automation using scripts
- Reduced manual intervention in software delivery
GitHub (Source Code Repository) │ ▼ Jenkins Master Server (Controller)
- Pipeline orchestration
- Job scheduling │ ▼ Jenkins Agent Server (Execution Node)
- Maven build execution
- Unit testing
- SonarCloud analysis
- Ansible execution │ ▼ Ansible (Executed on Agent - Local Mode)
- Backup existing deployment
- Stop Tomcat server
- Deploy new WAR file
- Restart Tomcat server │ ▼ Tomcat Server
- Hosts deployed Java application
- GitHub – Source Code Management
- Jenkins – CI/CD Orchestration (Master–Agent setup)
- Maven – Build automation for Java/Spring Boot
- SonarCloud – Code quality and security analysis
- Ansible – Deployment automation
- Tomcat Server – Application hosting
- Bash Scripts – Infrastructure automation
- Developer pushes code to GitHub
- Jenkins Master triggers pipeline
- Jenkins Agent pulls source code
- Maven builds application (WAR file)
- Unit tests are executed
- SonarCloud performs code analysis
- Quality Gate validation is enforced
- If successful, Ansible deploys to Tomcat
- Application is restarted and deployed
- Detects bugs and vulnerabilities
- Identifies code smells
- Ensures maintainability standards
- Enforces Quality Gate before deployment
- Prevents low-quality code from being deployed
- Controls pipeline execution
- Handles scheduling and orchestration
- Does not run heavy workloads
- Executes build, test, and deployment tasks
- Runs Maven, SonarCloud, and Ansible
- Provides scalability and isolation
Ansible runs in local mode on Jenkins agent:
[localhost] localhost ansible_connection=local
- Backup existing WAR file
- Stop Tomcat server
- Remove old deployment
- Copy new WAR file
- Restart Tomcat server
- Creates backup of
/opt/tomcat/webapps - Generates timestamped
.tar.gzfiles - Ensures rollback capability if needed
- Installs Jenkins
- Configures system services
- Enables Jenkins at boot
- Retrieves initial admin password
- Creates Jenkins agent user
- Configures SSH key authentication
- Enables master–agent communication
- Generates key pair on Jenkins master
- Public key is copied to agent server
- End-to-end CI/CD automation
- Jenkins distributed architecture (Master–Agent)
- Code quality enforcement using SonarCloud
- Automated deployment using Ansible
- Tomcat-based application hosting
- Infrastructure automation using Bash scripts
- Backup-based deployment safety
- SonarCloud failure → pipeline stops
- Build failure → deployment skipped
- Ansible failure → deployment not executed
- Backup enables manual recovery
- Dockerize application deployment
- Add Slack/email notifications
- Implement automated rollback strategy
- Introduce dev/staging/prod environments
- Add artifact versioning system
- Replace SSH setup with Ansible/Terraform automation
- CI/CD pipeline design
- DevSecOps practices
- Jenkins Master–Agent distributed architecture
- Configuration management using Ansible
- Build automation using Maven
- Infrastructure automation using Bash scripts
- Real-world deployment workflow using Tomcat
- Basic release safety using backup strategy
This project demonstrates a production-style DevSecOps CI/CD pipeline using Jenkins, Maven, SonarCloud, Ansible, and Tomcat with a distributed Master–Agent architecture, covering the full software delivery lifecycle from code commit to deployment.