Day 24: Mastering End-to-End Jenkins CI/CD: Building, Deploying, and Automating Using Web Hook🚀
Day#24 Of 90 Days Of DevOps Challenge
✨Introduction
Welcome to the ultimate guide for becoming a Jenkins CI/CD expert! In today's fast software world, making and delivering software quickly is super important. That's where Continuous Integration and Continuous Deployment (CI/CD) come in – they're like the magic spells that help developers work faster.
Whether you're new to this or a bit experienced, this blog will help you use Jenkins like a superhero for your software.
Each part has easy tips to help you get better at CI/CD. Let's start our journey to becoming Jenkins CI/CD experts together!
⚓Task-01: Setting Up Jenkins with GitHub for CI/CD using GiHub webhooks
We'll finish this task by going through the steps in the following procedure, one after the other.
Step 1: Fork the repository: https://github.com/LondheShubham153/node-todo-cicd
Step 2: Login into the Jenkins dashboard and create a freestyle Project
Step 3: Enter the GitHub repo URL of your forked repository here
Step 4: Select the Source Code Management as Git and paste the URL from the forked repository.
Step 5: In Build Triggers: Select the GitHub hook trigger for Gitscm Polling.
Step 6: Build a link between your Jenkins task and your GitHub Repository through GitHub Integration by utilizing a Git Webhook. Input the git URL of your project.
Step 7: Open the forked GitHub repository, Go to the repository's "Settings" tab.
Step 8: Select "Webhooks" from the left-hand menu & Click on the "Add webhook" button.
Step 9: In the "Payload URL" field, enter the Jenkins URL & Select the events that you want to trigger the webhook.
Step 10: Click "Add webhook" to save the webhook configuration.
Step 11: Again come to the Jenkins dashboard, click on Build steps > Execute Shell > Enter the command that will be executed after the job is built & save.
Step 12: Now, refresh the page unless the webhook URL is ticked as shown below.
Step 13: Now, to test the webhook, make a small code change in your GitHub repository and commit it:
Step 14: Now, whenever you push code to your GitHub repository, the webhook will send a request to the Jenkins job's URL. This will trigger the Jenkins job automatically, running your specified build and deployment steps.
🔰Task 2: Effortless Application Deployment using Webhooks and Docker Compose
Step 1: Here follow the same steps till adding WebHook
Step 2: Now, change the execute shell command as below & Save the Jenkins Job.
Step 3: Now, to test the webhook, make a small code change in your GitHub repository and commit it
Step 4: Now, whenever you push code to your GitHub repository, the webhook will send a request to the Jenkins job's URL. This will trigger the Jenkins job automatically, running your specified build and deployment steps.
👏Conclusion
Webhooks serve as tools that permit GitHub to inform external services (such as Jenkins) about activities taking place in a repository. These activities might include actions like pushing code, making pull requests, or updating issues.
When you set up a webhook within your GitHub repository settings and furnish the URL of your Jenkins server, you activate a system where GitHub sends event-related information to Jenkins every time significant actions occur.
Thank you for taking the time to read this blog. I hope you found the information helpful and insightful. So please keep yourself updated with my latest insights and articles on DevOps 🚀 by following me on :
Hashnode: vishaltoyou.hashcode.dev
LinkedIn: linkedin.com/in/vishalphadnis
So, Stay in the loop and stay ahead in the world of DevOps!
Happy learning 🚀😊🐧📦🔧🛠️💻💼🔍📈🚀🌟📊📚