๐ Week 6 โ Jenkins (CI/CD) Challenge


This weekโs challenge was all about Jenkins, one of the most popular CI/CD tools.
I worked on real-world tasks like creating pipelines, multi-branch jobs, configuring agents, RBAC, shared libraries, vulnerability scanning with Trivy, email notifications, and debugging pipelines.
The goal was to simulate real DevOps scenarios and prepare for interviews by gaining hands-on experience.
๐น Task 1: Create a Jenkins Pipeline Job for CI/CD
Steps:
Created a new Pipeline Job in Jenkins.
Wrote a Jenkinsfile with three stages: Build, Test, Deploy.
pipeline {
agent any
stages {
stage('Build') {
steps {
echo 'Building the application...'
sh 'docker build -t sample-app:v1.0 .'
}
}
stage('Test') {
steps {
echo 'Running tests...'
sh 'docker run --rm sample-app:v1.0 npm test'
}
}
stage('Deploy') {
steps {
echo 'Deploying application...'
sh 'docker run -d -p 8080:80 sample-app:v1.0'
}
}
}
}
โ
Verified with docker ps
that container was running.
Interview Takeaways:
Declarative pipelines are easier to maintain than scripted ones.
Breaking into stages makes it easier to troubleshoot failures.
๐น Task 2: Multi-Branch Pipeline for Microservices
Steps:
Created a Multi-Branch Pipeline Job.
Configured Jenkins to scan GitHub repo branches.
Each microservice had its own
Jenkinsfile
with stages: Checkout โ Build โ Test โ Deploy.Used parallel stages to test multiple services at once.
parallel {
stage('Service-A Tests') { steps { sh './test-service-a.sh' } }
stage('Service-B Tests') { steps { sh './test-service-b.sh' } }
}
โ Simulated feature branch merge with PR workflow.
Interview Takeaways:
Multi-branch pipelines automatically handle new branches.
Challenge: Managing dependency between services when merging branches.
๐น Task 3: Configure & Scale Jenkins Agents
Steps:
Added two agents:
Linux (Docker container)
Windows (VM)
Gave them labels like
linux
,windows
.Updated Jenkinsfile to run jobs on specific agents:
stage('Build on Linux') {
agent { label 'linux' }
steps { sh 'make build' }
}
โ Ran jobs in parallel across agents โ faster builds.
Interview Takeaways:
Distributed agents increase scalability & reliability.
Correct job assignment requires proper labels.
๐น Task 4: Implement RBAC
Steps:
Installed Role Strategy Plugin.
Created roles:
Admin โ Full access
Developer โ Build & view jobs
Tester โ Only read access & trigger jobs
Created test accounts and verified access.
โ Developers couldnโt change configs, testers couldnโt delete jobs.
Interview Takeaways:
RBAC prevents unauthorized access.
Weak RBAC can lead to pipeline tampering or security breaches.
๐น Task 5: Jenkins Shared Library
Steps:
Created a Git repo
jenkins-shared-lib
.Added reusable
vars/notify.groovy
function:
def call(String message) {
echo "Notification: ${message}"
}
- Used it in pipeline:
@Library('jenkins-shared-lib') _
pipeline {
stages {
stage('Notify') {
steps {
notify("Build completed successfully")
}
}
}
}
โ Avoided code duplication across pipelines.
Interview Takeaways:
Shared libraries improve maintainability.
Ideal for tasks like notifications, deployment scripts, code quality checks.
๐น Task 6: Vulnerability Scanning with Trivy
Steps:
Installed Trivy inside Jenkins agent.
Added scan stage:
stage('Vulnerability Scan') {
steps {
sh 'trivy image sample-app:v1.0'
}
}
- Configured build to fail if critical vulnerabilities found.
โ Got scan results and patched vulnerable dependencies.
Interview Takeaways:
Automated scanning ensures security in CI/CD.
Trivy detects CVEs in images before deployment.
๐น Task 7: Dynamic Pipeline Parameterization
Steps:
Added runtime parameters:
pipeline {
agent any
parameters {
string(name: 'TARGET_ENV', defaultValue: 'staging')
string(name: 'APP_VERSION', defaultValue: '1.0.0')
}
stages {
stage('Deploy') {
steps {
echo "Deploying version ${params.APP_VERSION} to ${params.TARGET_ENV}"
}
}
}
}
โ Deployed same pipeline to staging & production with different values.
Interview Takeaways:
Parameterization makes pipelines flexible.
Useful in multi-env deployments (Dev, QA, Prod).
๐น Task 8: Email Notifications
Steps:
Configured SMTP in Jenkins.
Added
emailext
stage:
stage('Notify') {
steps {
emailext (
subject: "Build Notification: ${env.JOB_NAME} #${env.BUILD_NUMBER}",
body: "Check build logs at: ${env.BUILD_URL}",
to: "team@example.com"
)
}
}
โ Team received build notifications.
Interview Takeaways:
Keeps teams updated automatically.
Troubleshoot issues via SMTP logs & Jenkins email plugin config.
๐น Task 9: Troubleshooting, Monitoring & Debugging
Steps:
Simulated failure by breaking a command in Jenkinsfile.
Debugged with:
Jenkins console logs
docker logs <container_id>
Replay feature for quick fixes.
Added debug statements:
echo "Environment: ${env.BUILD_NUMBER}"
โ Identified errors quickly.
Interview Takeaways:
Debugging = console logs + replay + echo statements.
Monitoring can be done with plugins (Prometheus, Monitoring plugin).
๐ Key Learnings
Jenkins pipelines make automation repeatable & reliable.
Multi-branch pipelines simplify microservices CI/CD.
Agents help in scaling workloads across environments.
RBAC secures CI/CD environments.
Shared libraries & parameterization โ reusability & flexibility.
Security scanning with Trivy is essential in DevOps pipelines.
Email notifications + monitoring keep teams informed.
๐ฌ This hands-on week gave me real-world exposure to Jenkins CI/CD pipelines โ from basics to advanced use cases like multi-branch pipelines, RBAC, shared libraries, vulnerability scanning, and troubleshooting.
Now I feel more confident in setting up production-grade CI/CD pipelines that are scalable, secure, and flexible. ๐
๐ค Connect With Me
๐LinkedIn: linkedin.com/in/vaishnavi-tandekar
๐ Blog Series: hashnode.com/@VaishnaviTandekar
๐ป GitHub Repo: 90DaysOfDevOps
๐ Hashtags:
#90DaysOfDevOps #Jenkins #CI/CD #DevOps #Automation #Microservices #CloudNative #InterviewPrep
Subscribe to my newsletter
Read articles from Vaishnavi Tandekar directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Vaishnavi Tandekar
Vaishnavi Tandekar
Hey there! Iโm Vaishnavi ๐ Learning DevOps step by step ๐ ๏ธ Writing what I learn so no one learns alone โจ