GitHub Webhooks

These repos are currently polled to check for changes. It would be significantly more efficient for the teams if changes to the GitHub repos caused an immediate ping to our internal, Jenkins based, CI servers.

GitHub provides the Webhooks mechanism to allow for this interaction. These Webhook take the form of a payload based HTTP POST event.

We currently have two Mac Mini’s (One for each of iOS and Android development) which need to be the recipients of these incoming POSTs.

As these Mac Mini’s reside on our LAN appropriate firewall rules will need to be created to allows the Github originated HTTP POSTs through out firewall to the Mac Minis.

The following script can be used to obtain the IP/CIDR for the GitHub webhook IP address range (Via /meta).


We would like to link our local, Jenkins based build system to our hosted GitHub accounts.

I believe that this will require a firewall change to allow to GitHub server(s) to trigger a build (Via a WebHook) on our local server.

Obviously more details will be needed and this is just a placeholder ticket to start the ball rolling.


Remotely triggering Jenkins

  • https://wiki.jenkins-ci.org/display/JENKINS/Remote+access+API
  • https://wiki.jenkins-ci.org/display/JENKINS/Parameterized+Remote+Trigger+Plugin
  • http://stackoverflow.com/questions/20337033/webhook-proxy-for-jenkins-in-internally-visible-jenkins-instance
# Allow *only* the notifyCommit endpoint, and don't expose any other info
location = /git/notifyCommit {
  proxy_pass              http://jenkins.int.example.com:8080/git/notifyCommit
  proxy_hide_header       X-Powered-By;
  proxy_intercept_errors  on;
  error_page              500 /;
}

Or git-webhook-proxy on GitHub

Also general notes on (githooks](http://stackoverflow.com/questions/3462955/putting-git-hooks-into-repository) & here

  • http://stackoverflow.com/questions/3311869/writing-git-hooks-in-python-bash-scripts
  • https://www.digitalocean.com/community/tutorials/how-to-use-git-hooks-to-automate-development-and-deployment-tasks
  • https://www.atlassian.com/git/tutorials/git-hooks/
  • https://www.sitepoint.com/introduction-git-hooks/