Day 73: Project-2 (Jenkins Webhook)

Day 73: Project-2 (Jenkins Webhook)

Jenkins & Github using webhook


In the previous Blog: Day 72: Project-1, we have already gone through the steps on how to install Jenkins & and the Prerequisites to install it.

This blog is a continuation of the previous one and will delve into further stages of the CI/CD pipeline by adding GitHub webhooks.

When Jenkins gets a push notification from GitHub, the GitHub Plugin checks if it's from the same GitHub repository as the one specified in the job's Git settings. If it's a match and you have the option enabled, the GitHub Plugin will perform a one-time check on the Git repository. When this check finds a change on GitHub, it tells the GITScm to start a build. It's important to note that the polling and starting the build are actions of the Git plugin, not the GitHub plugin.

Creating Webhook

At first, we need to install "Git integration".

You can follow the below steps:

Go to Jenkins Dashboard--> Manage Jenkins

Click on Plugins

Go to Available plugins--> Search "GitHub integration" & proceed to install.

Also restart Jenkins once the extension is downloaded

Now, go to your GitHub home page--> settings

Select SSH and GPG keys

Create a new SSH key

Complete the information

To enter the "Key" information, Go to the terminal and if a private/ public key is not created then use the below command to create new key.

ssh-keygen -t rsa

Go to the public key file and copy its content.

Go back to GitHub and continue by pasting the public key in "Key" and clicking on Add SSH key

Go to GitHub dashboard --> Repositories --> "react_django_demo_app" --> Settings --> Webhooks --> Add Webhooks

Enter all the details:

Payload URL: http://<public_ip_of_ec2_or_local_machine>:8080/github-webhook/

Content-Type: application/json

Which event would you like to trigger this webhook?

-> Just the push event.

Active: True

Click on “Add Webhook”.

Go to Jenkins Dashboard --> Configure --> General --> tick on - GitHub hook trigger for GITScm polling

Make changes in the repository, Commit the changes and rerun the build


In this blog, we continued our journey into CI/CD with Jenkins by adding GitHub webhooks. This integration automates builds upon code pushes to the GitHub repository, enhancing the efficiency of your development process. By following the steps outlined, you're well on your way to a streamlined and automated CI/CD pipeline.

Hope you like my post. Don't forget to like, comment, and share.