๐ Day 24 of #90daysofdevopschallenge! Let's craft a stunning CI/CD Pipeline for your Node JS App! ๐ But before we dive in, let's decode GitHub webhooks and master the art of connecting GitHub with Jenkins. ๐ต๏ธโโ๏ธโจ
GitHub Webhooks:
GitHub webhooks, your silent CI/CD partner! ๐ค They notify you about events like code pushes, PRs, and more. Perfect for automating tasks like building, testing, and deploying code. ๐
GitHub webhooks have superpowers:
๐ They go beyond CI/CD pipelines.
๐ ๏ธ Handy for automated testing, issue tracking, and project management.
๐จ Great for deployment, release management, and chat integration.
๐ค Custom workflows and integrations? Absolutely!
๐ Plus, they help with security and compliance. ๐ก๏ธ
In a nutshell, GitHub webhooks make your code collaboration smoother and more automated! ๐ค
Benefits of Jenkins GitHub Webhooks:
Jenkins GitHub Webhook is a DevOps gem! ๐ Speeds up development, resolves issues swiftly, and automates the build, test, and deployment processes across platforms. ๐ค๐จ
Hands-on CI/CD project! ๐ช๐ง
Task-1: Getting Started with Jenkins and GitHub for CI/CD using GitHub Webhooks
๐ ๏ธ Step 1: Fork the Repository
Head to github.com/Nilkanth1010/node-todo-cicd.git
and hit "Fork" to create your copy.
๐ ๏ธ Step 2: Create a Freestyle Project in Jenkins
Log in, click "New Item," name your project, select "Freestyle project," and click "OK".
๐ ๏ธ Step 3: Configure Repository URL In project settings, select "Git," paste your forked repo's URL, and provide SSH credentials.
๐ ๏ธ Step 4: Setting Up Connection Between GitHub & Jenkins Generate SSH keys, add to GitHub, and configure the build steps in Jenkins.
๐ ๏ธ Step 5: Scroll down to Build Steps Use 'execute shell' to build and run your Node JS app in Docker
Go to build steps and select the execute shell option.
docker build . -t node_todo_app
docker run -p 8000:8000 -d node_todo_app
๐ ๏ธ Step 6: Setting Up Webhook Manage Jenkins, install GitHub integration plugin, and add a webhook in your GitHub repo settings.
๐ ๏ธ Step 7: Go to Build Triggers Configure GitHub Hook trigger for GITScm pooling
Task-02: Execute Shell for Docker Compose Enhance your Jenkins job by configuring Docker Compose and deployment script.
# Stop and remove the existing containers
docker-compose down
docker build -t nodo-todo .
docker-compose up -d --name web1
Conclusion: Jenkins GitHub webhook integration, your key to seamless CI/CD! ๐งฉ Follow these steps, set up, and test your Jenkins GitHub webhook integration to automate your code's build and testing. Stay tuned for more Jenkins insights in the next article! ๐๐