DEV Community

Azmat Ahmed
Azmat Ahmed

Posted on

πŸš€ DevOps Journey – Week 10 (Mastering Jenkins CI/CD)

πŸ”Ή Recap

This week was all about Jenkins. I built multiple pipelines and deployed my Node.js app to AWS EC2 using Jenkins. Now, when I update my GitHub repo and click Build Now, Jenkins automatically updates my app on EC2.

βœ… Achievements

Set up Jenkins on my server

Configured Jenkins pipeline for Node.js app

Connected GitHub β†’ Jenkins β†’ EC2 deployment

Used PM2 to manage and restart the Node.js app

Automated CI/CD successfully πŸŽ‰

πŸ”Ή Jenkins Pipeline Script
pipeline {
agent any
stages {
stage('Checkout') {
steps {
git branch: 'main',
url: 'https://github.com/Azmat-Ahmed/deploycicd.git'
}
}
stage('Dependencies') {
steps {
sh 'npm install'
}
}
stage('Deploy') {
steps {
sh """
ssh -o StrictHostKeyChecking=no -i /var/lib/jenkins/test.pem ubuntu@ << 'EOF'
cd /home/ubuntu/deploycicd
git pull origin main
npm install
pm2 restart app.js || pm2 start app.js
EOF
"""
}
}
}
}

🎯 What’s Next?

In the next stage of my journey, I will be exploring:

GitHub Webhooks β†’ for fully automated Jenkins triggers

GitHub Actions β†’ GitHub’s native CI/CD tool

But for now, I can confidently say: Week 10 = Jenkins Mastery βœ…

πŸ‘‰ My portfolio: azmatahmed.netlify.app

Top comments (0)