7

5

Does Kiln support web hooks for integration with continuous integration servers and other software like GitHub and BitBucket?

flag

1 Answer

9

Kiln has built-in intgration with many popular services. Check out the full list, or learn more about writing a custm web hook below.


Yup! Kiln administrators can add web hooks as useful integration points between Kiln and any number of other services.

Just choose the URL Kiln should hit and which repositories should fire the hook. Then, every time these repositories receive a push, information about the push and its changesets will be POST'ed to the URL.

The data POST'ed is a JSON payload, and the data is accessible via the "payload" POST variable. So if you're in .NET land, you'd access the JSON payload like so:

string s = Request["payload"];

...and string s will contain a JSON string of the following format:

{
  "commits": [
    {
      "author": "Ben Kamens <ben@fogcreek.com>", 
      "branch": "default", 
      "id": "16265aef917cfe137e250c4f71a4a77ff4ad0974", 
      "message": "This thing is taking forever", 
      "revision": 14, 
      "timestamp": "3\/23\/2010 3:42:42 PM", 
      "url": "http:\/\/kamens.kilnhg.com\/Repo\/Personal\/Playground\/DNForever\/History\/16265aef917cfe137e250c4f71a4a77ff4ad0974",
      "tags": [
        "tip"
      ]
    }, 
    {
      "author": "Ben Kamens <ben@fogcreek.com>", 
      "branch": "default", 
      "id": "a077d19afed224dc7c46dc535d5f7e90546ed5bd", 
      "message": "This version is now shippable", 
      "revision": 15, 
      "timestamp": "3\/23\/2010 3:42:46 PM", 
      "url": "http:\/\/kamens.kilnhg.com\/Repo\/Personal\/Playground\/DNForever\/History\/a077d19afed224dc7c46dc535d5f7e90546ed5bd",
      "tags": []
    }
  ], 
  "pusher": {
    "email": "ben@fogcreek.com",
    "fullName": "Ben Kamens"
  },
  "repository": {
    "central": true,
    "description": "Picking up where the others left off", 
    "id": 1,
    "name": "DNForever", 
    "url": "http:\/\/kamens.kilnhg.com\/Repo\/Personal\/Playground\/DNForever"
  }
}

...which you can then parse and use however necessary in your continuous integration server or any piece of software that needs to know when Kiln receives a push.

The repository.id key is the repository's ixRepo, suitable for sending to the Kiln API.

Note that the timestamp for commits are in UTC.

Please keep in mind that this data will be sent regardless of your Kiln repository's permissions settings.

Here are some instructions for testing your web hook to make sure it's firing.

link|flag
Is there a log somewhere in Kiln which notes whether or not it has called a web hook? We're implementing one to email the commit details and we're getting no confirmation that it's being called. Our web hook has logging in and nothing is appearing so suggests it's not being called. – Paul Healey May 12 2010 at 11:31
1 
Paul, can you go to postbin.org, create a postbin for yourself, and then use that URL as your web hook? The push to one of your repositories and see if any data shows up in your postbin (just refresh the page). Do this with some non-sensitive data as your commit information will be publicly available. If the data shows up on postbin, the hook is most likely firing... – Ben Kamens May 12 2010 at 14:44
Ben, we've just used postbin as suggested and you're correct Kiln is working fine. I've passed it back to the dev working on the web hook to take it from there. Thanks for your help. – Paul Healey May 12 2010 at 16:43
Ben, a further update, we've got our emailer web hook working great, but we have a bit of an issue when we do a large push between repositories. It seems the JSON PUSH data is being truncated at around 64KB and we're not sure if it's something from the Kiln's end or IIS (we're running version 6). We've run some tests against our web hook with pushes with large amounts of data to it (64KB+, approx 180KB) and it seems to be OK. We also pushed our test data to postbin without issue. Continues in next comment... – Paul Healey May 14 2010 at 10:01
4 
WAY off topic #sosorry, but +1 for Duke Nukem Forever reference. – Jonathan Mabe Sep 17 2010 at 22:21
show 8 more comments

Your Answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.