Configure Github WebHook For Jenkins

Configure Github WebHook For Jenkins

webhooks are used to notify instantly whenever any changes happened in server. if any changes happens in git hub it will the send request to client, in our scenario Jenkins is our client.

git hub webhook is used in Jenkins to build the jobs whenever any changes happens in git hub code repository. GitHub will the push request to Jenkins. and Jenkins will trigger the jobs which are configured as GitHub hook trigger in build triggers of Jenkins jobs. in the below steps i will show you how to configure git hub webhooks for Jenkins step by step.

Configure GitHub webhook for Jenkins

in your git hub code repository go to =>settings go to =>webhooks click on =>add webhooks.

Configure Github Web Hook For Jenkins

enter URL of  jenkins server in playload URL as  jenkinsurl/github-webhook/

ex http://52.54.125.117:8080/github-webhook/

Make sure that your Jenkins playload URL should end with /(slash) otherwise you will get errors. and webhook will not work as expected.

in content type select application/Jenkins

Leave “Secret” blank (unless a secret has been created and configured in the Jenkins “Manage Jenkins -> Configure System -> GitHub Servers” section)

Which events would you like to trigger this webhook?
select anyone in this according to your needs and make sure that active is checked.

Click click on “Add Webhook”

Configure GitHub webhook in  Jenkins

Go to build trigger section in Jenkins job configuration and select GitHub hook trigger for GITScm polling.

jenkins github webhook

by selecting this trigger, this job will run whenever Jenkins receive git hub webhook request from git hub. Git hub webhook will send request according to your choices which you selected in “which events would you like to trigger this webhook” option in git hub webhooks.
That’s all we have successfully configured git hub webhook for Jenkins.

NOTE:
Make sure that allow 8080 port of Jenkins from git hub server in your security groups or firewalls. If you have not allowed, github webhook request will not reach jenkins server and this webhook concept will not workout.

github webhook jenkins

 

  • configure git hub webhook for Jenkins
  • Jenkins git hub webhook payload
  • Jenkins webhook git hub configuration
  • git hub hook trigger for gitscm polling
  • Jenkins git hub hook trigger for gitscm polling

Leave a Reply

Your email address will not be published. Required fields are marked *