🔹 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: https://azmatahmed.netlify.app
Top comments (0)