Automatic Build Configuration In Jenkins Using Webhook Of GitHub

Travel

Jenkins is providing multiple way of build triggering. One of them is automatic build trigger.

When we say automatic build trigger, it is not exactly automatic. It needs some action to trigger it. That action is when you commit new change and push to your codebase or remote repository the build will get triggered.

you commit your changes or push something to your codebase or remote repository

This can be done by integrating webhook URL of repository.

Integration of GitHub with Jenkins:

If you want to use codes from GitHub repository, you need to install jenkins plugin “GitHub Plugin”.

You can install the plugin through Manage Jenkins →> Manage Plugins →> Available →> GitHub plugin

Steps to integrate and configure webhook:

After install the plugin, create a job with GitHub repository url and credentials, under the Build Triggers section select “GitHub hook trigger for GITScm polling” and save the job.

Configure Webhook from GitHub:

Login to your GitHub account and choose Repository -> Settings -> Webhooks -> Add new webhooks

Payload URL you can add your “jenkins_url/github-hook/”.

i.e.., “162.458.26.452:8090/gihub-hook/ “

(Note: Remember to add the “/” at the end of the url)

Thats it. We have done. After this configuration jenkins will start detect the changes. Once it finds changes in repository, it will start triggering the job. like this push event, you can change the event of triggering based on your project need by enabling “Let me select individual events” under event section.