Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
0e8d2557
Commit
0e8d2557
authored
10 years ago
by
Sytse Sijbrandij
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'endpoint_example' into 'master'
Add an example webhook receiver
parents
f18f8e67
ad7de951
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
0 deletions
+31
-0
doc/web_hooks/web_hooks.md
doc/web_hooks/web_hooks.md
+31
-0
No files found.
doc/web_hooks/web_hooks.md
View file @
0e8d2557
...
...
@@ -112,3 +112,34 @@ Triggered when a new merge request is created or an existing merge request was u
}
}
```
#### Example webhook receiver
If you want to see GitLab's webhooks in action for testing purposes you can use
a simple echo script running in a console session.
Save the following file as
`print_http_body.rb`
.
```
ruby
require
'webrick'
server
=
WEBrick
::
HTTPServer
.
new
(
Port
:
ARGV
.
first
)
server
.
mount_proc
'/'
do
|
req
,
res
|
puts
req
.
body
end
trap
'INT'
do
server
.
shutdown
end
server
.
start
```
Pick an unused port (e.g. 8000) and start the script:
`ruby print_http_body.rb
8000`
. Then add your server as a webhook receiver in GitLab as
`http://my.host:8000/`
.
When you press 'Test Hook' in GitLab, you should see something like this in the console.
```
{"before":"077a85dd266e6f3573ef7e9ef8ce3343ad659c4e","after":"95cd4a99e93bc4bbabacfa2cd10e6725b1403c60",<SNIP>}
localhost - - [14/May/2014:07:45:26 EDT] "POST / HTTP/1.1" 200 0
- -> /
```
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment