Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I create a GitLab webhook?

I've read that GitLab is capable of sending messages to other servers via "web hooks" but I can't find where one would create one.

Can someone point me in the right direction?

like image 983
leech Avatar asked Jun 17 '13 22:06

leech


People also ask

How do I make a webhook server?

To set up a webhook, go to the settings page of your repository or organization. From there, click Webhooks, then Add webhook. Alternatively, you can choose to build and manage a webhook through the Webhooks API. Webhooks require a few configuration options before you can make use of them.


4 Answers

All the answers I've found in official documentation and on Stack Overflow for finding web hooks are incorrect. The admin area > hooks page does NOT contain web hooks. It contains system hooks, which fire when you create/delete projects and users and things like that. This is not what you want.

To find your web hooks, go to the specific project > settings > web hooks (on sidebar in GitLab 6.1.0) page. These will fire on post-receive for the project in question. You can use a service like RequestBin to see what the payload looks like and to ensure you're firing these off correctly for debugging purposes.

like image 50
Jamey Avatar answered Oct 21 '22 01:10

Jamey


With version 8.16.1, I found the web hooks under

specific project > settings > integrations

enter image description here

like image 39
derwiwie Avatar answered Oct 21 '22 01:10

derwiwie


For group level hooks:

visit: https://gitlab.com/groups/<yourgroup>/hooks

For group project level hooks:

visit: https://gitlab.com/yourgroup/yourproject/hooks

like image 6
Blair Anderson Avatar answered Oct 20 '22 23:10

Blair Anderson


You can see an example of GitLab system hook, with a web_hook.rb creation in this GitHub project.

In gitlab, as admin, go to "Hooks" tab, create hook as: http://your.ip.goes.here:8000

or change the port on line 175 of the script.

For web hooks, see Jamey's more accurate answer.

You can inspect the result of a webhook with a service like RequestBin.
Another example of webhook interpretation: this question.

Be aware though that a few issues remain with gitlab webhook:

  • it is not always firing
  • There's no URL nor namespace key present on system's webhook
like image 4
3 revs Avatar answered Oct 21 '22 01:10

3 revs