How to configure webhooks in GitHub to trigger jobs in Jenkins

 

A Webhook is a mechanism to automatically trigger the build of a Jenkins project in response to a commit pushed to a Git repository.




Pre-Requistes:

Make sure you install GitHub integration plug-in in Jenkins

1. Go to Jenkins, Create a job. If you already have a existing job, click on configure. Go to build triggers section and choose the below option - GitHub hook trigger for GitScm pooling.


2. Now go to GitHub, choose your repository. Click on settings, Webhooks.

3. Click on Add web hook.

4. You need to enter Jenkins URL & add /github-webhook/ in the end
http://jenkins_public_dns_name:8080/github-webhook/

5. Now enter payload URL as Jenkins URL, select just push event, click on active. Click on Add webhook
6. After you created, click on webhooks.

7. Click on recent deliveries and you should get response 200 as below:

8. Now go and make some code changes in your repo in GitHub.

9. If you look in Jenkins, you will see job is getting triggered immediately.


You can watch these steps on my YouTube channel as well, please see below:

Comments

Popular posts from this blog

Install Ansible on Ubuntu | How to setup Ansible on Ubuntu 22.0.4 | Ansible install on Ubuntu

Installing SonarQube using Docker || Installing SonarQube using Docker on Ubuntu 22.0.4 || Installing SonarQube using Docker-Compose

Setup build agent/slave VM and Integrate with Jenkins Master