Jenkins : Webhooks

 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

 

 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

How to integrate Jenkins Jobs with Github Webhooks .

We want to trigger Jenkins Job Automatically whenever Git commits a push to the GitHub server. 

The author uses a Maven Based Java Project he wants to configure this repo as part of his Jenkins. 


Lets go to Jenkins and create a New Job there. 


Lets make it free style project and click Okay.

Under Score Code Management : copy the URL that is his repository . The scenario is whenever someone pushes a commit into this repository the Jenkins Job must trigger.


The webhook triggers from GitHub.

Open your repository -- Go to Settings -- Web-Hooks -- Add a Webhook --


We need to put this Payload URL . That URL will be Jenkins URL

You need to put Jenkins URL:8080(Port on which Jenkins is running on) / github-wenhook/ 


don't forget that ending / that is mandatory 

Under Content Type. we need to select application/json.  And add webhooks. 

So whenever commits are pushed to GitHub a notification is sent to Jenkins . Under Jenkins multiple jobs will be configured with same repository .  Along with that the Job is enabled with this below option.

"Github hook trigger for GitSCM Polling" 

Those jobs are auto-triggered by your Jenkins.

For testing this lets go to GitHub repository . Lets update some for some demo purpose and now Github should send the notification to Jenkins. And see there is a new job in the Queue is auto triggered.








Comments

Popular posts from this blog

Jenkins file | declarative pipeline scripting

JENKINS -- My Work -Project - DNS