In this post we will look at how we can use Webhooks feature of GitHub to Integrate Github with Jenkins.
Webhooks is a really a cool feature which helps to Integrate GitHub with Jenkins on the Push Events in Github.
There is a feature in Jenkins to Poll SCM for every configured number of Minutes/hours for change in the code. This way Jenkins is polling on SCM. Better/Preferred way is to use Webhooks for this integration where Whenever there is a Push in Github, a Payload is sent to Jenkins with Push/Commit details and New Pipeline is Initiated.
Pre Requsites
Webhooks is a really a cool feature which helps to Integrate GitHub with Jenkins on the Push Events in Github.
There is a feature in Jenkins to Poll SCM for every configured number of Minutes/hours for change in the code. This way Jenkins is polling on SCM. Better/Preferred way is to use Webhooks for this integration where Whenever there is a Push in Github, a Payload is sent to Jenkins with Push/Commit details and New Pipeline is Initiated.
Pre Requsites
- Jenkins Server Installed on any IaaS or Local VM.
- Github Login Credentials
- Code Repository in GitHub with Sample Code. I have forked a code in my repo and added JenkinsFile which you can use as it is MyGitHubRepo. Or You can also fork from Original Repo
Lets Get Started
Configuring Jenkins
First Step in Configuring Jenkins is to Install GitHub Integration Plugin. Log into Jenkins Server and Click Manage Jenkins. Click Manage Plugins.
Click on Available Tab and Filter with Github.