Jenkins - (private subnet) WebHook with Github does not trigger automatic build Jenkins - (private subnet) WebHook with Github does not trigger automatic build jenkins jenkins

Jenkins - (private subnet) WebHook with Github does not trigger automatic build


After spending some hectic hours, I have got it to a working state. Below is just a summary of what I have done:

  • You can do it in two ways, Poll SCM or WebHooks (explained here)
  • JenkinsURL/job/job-Name/scmPollLog is the place to check for polling logs
  • I have moved my Jenkins into a public subnet (github needs to talk to jenkins)
  • Go to https://github.com/settings/tokens and create your access token
  • On Jenkins > Manage Jenkins > Configure system > configure GitHub Web Hook, API URL - "https://api.github.com" Username - your github user name,OAuth token which was created above - Test it for success!!
  • Navigate to job configuration and under Build Triggers, select "Build when a change is pushed to GitHub"
  • Go to https://github.com/yourID/repoName/settings/hooks and Add a webhook
Payload URL - http://jenkinsIP:port/github-webhook/Content type - application/x-www-form-urlencodedSecret - noneWhich events would you like to trigger this webhook? - Just the push eventActive > Add webhook

You can check commit a change into the github and github shall send a POST request to your jenkins server which will trigger the build. You can check the logs in Recent Deliveries section.

enter image description here

If this same can be done for a private jenkins server like using port forwarding, or any other way. Please update.


I'll expand cody.codes comment given this one has sat idle for a while. You can configure a webhook payload delivery service such as smee.io which will intercept the webhooks that GitHub fires.

This Jenkins article outlines the setup instructions in detail, but the simplified overview is:

  1. GitHub event such as an SCM change occurs, and triggers a webhook to be fired to your configured Smee channel
  2. Smee channel (blue box on the image below) receives this webhook
  3. Jenkins server is subscribed to your custom smee channel, spots that there is a new event there, and triggers your job.

Simplified visual overview of the communication between GitHub, Smee, and Jenkins

Jenkins only makes an outbound connection in this setup (which is required to subscribe to your Smee channel) so your Jenkins server can remain behind your firewall.