PracticalWeb Ltd

Websites that work for you.

Github Jenkins Hook - Multiple Endpoints and API

I wanted to trigger multiple jenkins servers from a github hook.

I found this pull request which led me to look at the API

useful docs

My code

1
  curl --user "me:mypassword" --request POST --data @jenkins.json  https://api.github.com/repos/myorg/myproject/hooks

here jenkins.json is like

1
2
3
4
5
6
7
8
9
10
    {
      "name": "jenkins",
      "active": true,
      "events": [
        "push"
      ],
      "config": {
        "jenkins_hook_url": "http://jenkins.mydomain/github-webhook/"
      }
    }

What I found was that this just replaces my jenkins hook - which isn’t what I wanted.

But the more I looked at the service hooks the more it looked like the jenkins one just passes a standard payload to a url, which is the same as the generic webhook, so I tried adding the jenkins webhook URL as a standard webhook ( you are allowed multiples of these) and that seems to work.

Comments