From f4e0c56279007fd6cec3d8e6bd684f0483b0e0ff Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Tue, 3 May 2016 13:03:10 +0200 Subject: Improve documentation and web test for web hooks I wanted to share what I learned trying to debug web hooks using netcat. --- doc/web_hooks/web_hooks.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'doc/web_hooks/web_hooks.md') diff --git a/doc/web_hooks/web_hooks.md b/doc/web_hooks/web_hooks.md index c1c51302e79..6ffdb18339e 100644 --- a/doc/web_hooks/web_hooks.md +++ b/doc/web_hooks/web_hooks.md @@ -13,6 +13,19 @@ You can configure webhooks to listen for specific events like pushes, issues or Webhooks can be used to update an external issue tracker, trigger CI builds, update a backup mirror, or even deploy to your production server. +## Webhook endpoint tips + +If you are writing your own endpoint (web server) that will receive +GitLab web hooks keep in mind the following things: + +- Your endpoint should send its HTTP response as fast as possible. If + you wait too long, GitLab may decide the hook failed and retry it. +- Your endpoint should ALWAYS return a valid HTTP response. If you do + not do this then GitLab will think the hook failed and retry it. + Most HTTP libraries take care of this for you automatically but if + you are writing a low-level hook this is important to remember. +- GitLab ignores the HTTP status code returned by your endpoint. + ## SSL Verification By default, the SSL certificate of the webhook endpoint is verified based on -- cgit v1.2.1 From 5bd32954f619b521496bca200a0ed31615b8e736 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Mon, 9 May 2016 13:52:20 +0200 Subject: Remove space --- doc/web_hooks/web_hooks.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc/web_hooks/web_hooks.md') diff --git a/doc/web_hooks/web_hooks.md b/doc/web_hooks/web_hooks.md index 6ffdb18339e..45506ac1d7c 100644 --- a/doc/web_hooks/web_hooks.md +++ b/doc/web_hooks/web_hooks.md @@ -16,7 +16,7 @@ Webhooks can be used to update an external issue tracker, trigger CI builds, upd ## Webhook endpoint tips If you are writing your own endpoint (web server) that will receive -GitLab web hooks keep in mind the following things: +GitLab webhooks keep in mind the following things: - Your endpoint should send its HTTP response as fast as possible. If you wait too long, GitLab may decide the hook failed and retry it. -- cgit v1.2.1 From 6506a9dd4433a261531613b344c3307159cd7d72 Mon Sep 17 00:00:00 2001 From: Gabriel Mazetto Date: Fri, 13 May 2016 00:40:43 -0300 Subject: Added documentation to current Wiki Page event webhook --- doc/web_hooks/web_hooks.md | 54 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) (limited to 'doc/web_hooks/web_hooks.md') diff --git a/doc/web_hooks/web_hooks.md b/doc/web_hooks/web_hooks.md index 45506ac1d7c..0777463def5 100644 --- a/doc/web_hooks/web_hooks.md +++ b/doc/web_hooks/web_hooks.md @@ -695,6 +695,60 @@ X-Gitlab-Event: Merge Request Hook } ``` +## Wiki Page events + +Triggered when a wiki page is created or edited. + +**Request Header**: + +``` +X-Gitlab-Event: Wiki Page Hook +``` + +**Request Body**: + +```json +{ + "object_kind": "wiki_page", + "user": { + "name": "Administrator", + "username": "root", + "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80\u0026d=identicon" + }, + "project": { + "name": "awesome-project", + "description": "This is awesome", + "web_url": "http://example.com/root/awesome-project", + "avatar_url": null, + "git_ssh_url": "git@example.com:root/test-project.git", + "git_http_url": "http://example.com/root/awesome-project.git", + "namespace": "root", + "visibility_level": 0, + "path_with_namespace": "root/awesome-project", + "default_branch": "master", + "homepage": "http://example.com/root/awesome-project", + "url": "git@example.com:root/awesome-project.git", + "ssh_url": "git@example.com:root/awesome-project.git", + "http_url": "http://example.com/root/awesome-project.git" + }, + "object_attributes": { + "title": "Awesome", + "content": "awesome content goes here", + "format": "markdown", + "message": "adding an awesome page to the wiki", + "slug": "awesome", + "url": "http://example.com/root/awesome-project/wikis/awesome", + "action": "create" + }, + "repository": { + "name": "awesome-project", + "url": "git@example.com:root/awesome-project.git", + "description": "test", + "homepage": "http://example.com/root/awesome-project" + } +} +``` + #### Example webhook receiver If you want to see GitLab's webhooks in action for testing purposes you can use -- cgit v1.2.1 From aaaed331ba06d14f0e071e0933a250c61caabf94 Mon Sep 17 00:00:00 2001 From: Gabriel Mazetto Date: Fri, 13 May 2016 04:21:01 -0300 Subject: Fix hook data for Wiki Page event Added "wiki" section and removed "repository" --- doc/web_hooks/web_hooks.md | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'doc/web_hooks/web_hooks.md') diff --git a/doc/web_hooks/web_hooks.md b/doc/web_hooks/web_hooks.md index 0777463def5..8559b67af04 100644 --- a/doc/web_hooks/web_hooks.md +++ b/doc/web_hooks/web_hooks.md @@ -720,7 +720,7 @@ X-Gitlab-Event: Wiki Page Hook "description": "This is awesome", "web_url": "http://example.com/root/awesome-project", "avatar_url": null, - "git_ssh_url": "git@example.com:root/test-project.git", + "git_ssh_url": "git@example.com:root/awesome-project.git", "git_http_url": "http://example.com/root/awesome-project.git", "namespace": "root", "visibility_level": 0, @@ -731,6 +731,13 @@ X-Gitlab-Event: Wiki Page Hook "ssh_url": "git@example.com:root/awesome-project.git", "http_url": "http://example.com/root/awesome-project.git" }, + "wiki": { + "web_url": "http://example.com/root/awesome-project/wikis/home", + "git_ssh_url": "git@example.com:root/awesome-project.wiki.git", + "git_http_url": "http://example.com/root/awesome-project.wiki.git", + "path_with_namespace": "root/awesome-project.wiki", + "default_branch": "master" + }, "object_attributes": { "title": "Awesome", "content": "awesome content goes here", @@ -739,12 +746,6 @@ X-Gitlab-Event: Wiki Page Hook "slug": "awesome", "url": "http://example.com/root/awesome-project/wikis/awesome", "action": "create" - }, - "repository": { - "name": "awesome-project", - "url": "git@example.com:root/awesome-project.git", - "description": "test", - "homepage": "http://example.com/root/awesome-project" } } ``` -- cgit v1.2.1