Validate toolchains configurations, link Jenkins CI automation engines with Docker builds, provision AWS resources via Terraform, and deploy applications to Kubernetes.
Environment
Jenkins / K8s / Terraform
Difficulty
Capstone
Course Module
Chapter 12: Capstone
Deliverables
Integrated Pipeline Run Logs
1. System Architecture & Workflow
The diagram below displays the end-to-end DevOps pipeline, showing the workflow from code commits on GitHub, to automated builds, resource provisioning, and container deployment.
2. Part 1: Step-by-Step Action Items & Key Execution Steps
STEP 1
Validate the Complete DevOps Toolchain
Run diagnostic checks to verify that all compilers, package managers, and container runtimes are installed and configured.
This command maps local port 8080 to the application service inside Kubernetes, enabling host system browser testing.
$ kubectl get pods --all-namespaces && kubectl logs -l app=devops-app
This command queries the cluster status and outputs container logs to verify that the application started successfully.
3. Operational Pipeline Architecture
The diagram below traces the stages of the Jenkinsfile pipeline, from code checkout to compilation, containerization, and Kubernetes rollout.
4. Part 2: Complete Deliverable Assets & Production Templates
To automate the continuous delivery of the Capstone project, we will write a declarative Jenkinsfile that links compile, test, package, containerization, infrastructure, and Kubernetes rollout stages. Below is a step-by-step breakdown of how this pipeline is built, followed by the final combined script.
Step-by-Step Script Construction
Step 1
Define Environment Parameters
Setup environment variables to reference credentials, container tags, and configuration paths.
This boots the pipeline block on any agent and sets environment variables mapping your Docker Hub credentials, image name, Helm release label, and chart folder paths.
Step 2
Add Source Checkout and Compile Stages
Implement source retrieval and unit test verification scripts.
This stage packages source libraries into a JAR file, log into Docker Hub using credentials, builds a container tagged with the build number, and pushes the image.
Step 4
Provision Infrastructure via Terraform
Initialize and apply local security parameters and AWS EC2 resources automatically.
stage('Terraform Plan / Apply') {
steps {
sh 'cd ./terraform && terraform init && terraform apply -auto-approve'
}
}
This changes directory to your Terraform files, initializes regional provider plug-ins, and applies changes automatically without prompt blocks.
Step 5
Deploy to Kubernetes Cluster using Helm Charts
Deploy application container revisions using Helm upgrade commands.
stage('Deploy via Helm') {
steps {
sh 'helm upgrade --install ${HELM_RELEASE} ${CHART_PATH} --set image.tag=${BUILD_NUMBER}'
}
}
This command invokes Helm to install or upgrade the release chart, dynamically setting the container image tag parameters to match the latest build.
Combined Complete Configuration File
Save the consolidated blocks above as Jenkinsfile in the root folder of your project repository, commit it, and push it to trigger the capstone pipeline: