CI/CD & Automation

Jenkins Scripted Pipeline: The Complete Architecture

A deep dive into automating deployments across 8 Servers using Jenkins, Ansible, Tomcat (QA/PA), and a private AWS EC2 Docker Registry.

The 8-Server Topology

To simulate a real-world enterprise environment, this pipeline orchestrates tasks across a distributed infrastructure:


1x Jenkins Master
Orchestration

1x Ansible Node
Config Management

1x AWS Registry
Image Storage

4x Tomcat Servers
2 QA / 2 PA (Prod)

Pipeline Workflow
1. SCM Checkout
Pull code from Git
2. Build & Registry Push
Maven + Docker Push
3. Deployment (QA)
Deploy .war to Tomcat
4. Automated Testing
Run Selenium Scripts
5. Quality Gate
Check Pass/Fail Logic
6. Manual Approval
Promote to Prod
7. Production Deploy
Release to PA Servers
Why Scripted? Unlike Declarative pipelines, Scripted pipelines (Groovy) allow complex `try/catch` logic needed for legacy Tomcat integrations.

Select a Stage

Click on the left menu to view the Groovy code logic for that specific stage.

Jenkinsfile (Groovy)

// Select a stage to view code...