Webhooks?

Issue #214 new
zwarmapapa created an issue

I've got several repositories on a self hosted Kallithea installation, and everything has been working great so far.

Thing is, I've recently started working together with other companies, and now whenever I push to a repository, they will need a notification / API call on their servers to pull the latest version and to do whatever it is they do on their side.

Normally you'd use webhooks for this, but I've not found anything webhooks related in Kallithea at all. There's only one 'hook' related thing I can find in Kallithea, which is not configurable per repository.

My question is, how would I make this work in Kallithea? How would I setup the webhooks I need?

Comments (7)

  1. Andrej Shadura

    As it is now, you have to write a hook yourself (and enable it using .hgrc), for example in shell or Python, depending which you like more.

    Feel free to propose a patch that integrates something better though :)

  2. zwarmapapa reporter

    It would be nice if users could setup their own webhooks per repository, and that when the repository receives a push, the webhooks of the repository are retrieved (from the database) and are then being cURLed.

    Shouldn't be too hard to make, but I only program C++ and Java, I've never programmed Python. Besides that, I also don't know the code structure of Kallithea.

    Anyway, from what I know, all you'd need is a table with a foreign key to users and repositories that also contains a varchar for the URL. Then, during pushing, you just retrieve all rows that are linked to the repository from that table, loop through them, check if the user can read the repository, and if so, cURL the URL.

    Besides that, you'll need a simple interface in the repository settings that loads/displays the users webhooks, and with which you can create/edit/remove webhooks.

    Like I said, I don't know anything about Python or Kallithea's code structure, but in an average project this will take less than a day to make, probably even less than a couple of hours.

  3. Andrej Shadura

    The trouble with this is that the database structure is currently suboptimal, and every change has to be well thought through. @kiilerix has more to say on the topic.

  4. domruf

    As soon as we have repository settings I'd gladly implement webhooks.

    My PR #203 is waiting for ages. I think it is time to extend the DB schema.

  5. zwarmapapa reporter

    Is this project dead or something? All I see being added is (unit)tests and small GUI improvements, even though there are way higher priority things to do in this project than adding tests and improving the GUI.

    Anyway, I also noticed the link to #203 goes to issue 203, PR 203 is here: https://bitbucket.org/conservancy/kallithea/pull-requests/203 I hope PR 203 gets some wind at its back, although I don't expect anything to happen anytime soon.

  6. Andrej Shadura

    The project's not dead, not at all. There are some obstacles which prevent implementing some bigger features, and hopefully these obstacles will be solved very soon.

  7. Log in to comment