BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
2a0a7b42
Commit
2a0a7b42
authored
Nov 23, 2017
by
Alexis Reigel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
api support for merge_requests_events system hook
parent
9a5bfcfd
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
3 deletions
+23
-3
system_hooks.md
doc/api/system_hooks.md
+1
-0
entities.rb
lib/api/entities.rb
+2
-2
system_hooks.rb
lib/api/system_hooks.rb
+1
-0
system_hooks_spec.rb
spec/requests/api/system_hooks_spec.rb
+19
-1
No files found.
doc/api/system_hooks.md
View file @
2a0a7b42
...
@@ -33,6 +33,7 @@ Example response:
...
@@ -33,6 +33,7 @@ Example response:
"created_at"
:
"2016-10-31T12:32:15.192Z"
,
"created_at"
:
"2016-10-31T12:32:15.192Z"
,
"push_events"
:
true
,
"push_events"
:
true
,
"tag_push_events"
:
false
,
"tag_push_events"
:
false
,
"merge_requests_events"
:
true
,
"enable_ssl_verification"
:
true
"enable_ssl_verification"
:
true
}
}
]
]
...
...
lib/api/entities.rb
View file @
2a0a7b42
...
@@ -65,12 +65,12 @@ module API
...
@@ -65,12 +65,12 @@ module API
end
end
class
Hook
<
Grape
::
Entity
class
Hook
<
Grape
::
Entity
expose
:id
,
:url
,
:created_at
,
:push_events
,
:tag_push_events
,
:repository_update_events
expose
:id
,
:url
,
:created_at
,
:push_events
,
:tag_push_events
,
:
merge_requests_events
,
:
repository_update_events
expose
:enable_ssl_verification
expose
:enable_ssl_verification
end
end
class
ProjectHook
<
Hook
class
ProjectHook
<
Hook
expose
:project_id
,
:issues_events
,
:merge_requests_events
expose
:project_id
,
:issues_events
expose
:note_events
,
:pipeline_events
,
:wiki_page_events
expose
:note_events
,
:pipeline_events
,
:wiki_page_events
expose
:job_events
expose
:job_events
end
end
...
...
lib/api/system_hooks.rb
View file @
2a0a7b42
...
@@ -26,6 +26,7 @@ module API
...
@@ -26,6 +26,7 @@ module API
optional
:token
,
type:
String
,
desc:
'The token used to validate payloads'
optional
:token
,
type:
String
,
desc:
'The token used to validate payloads'
optional
:push_events
,
type:
Boolean
,
desc:
"Trigger hook on push events"
optional
:push_events
,
type:
Boolean
,
desc:
"Trigger hook on push events"
optional
:tag_push_events
,
type:
Boolean
,
desc:
"Trigger hook on tag push events"
optional
:tag_push_events
,
type:
Boolean
,
desc:
"Trigger hook on tag push events"
optional
:merge_requests_events
,
type:
Boolean
,
desc:
"Trigger hook on tag push events"
optional
:enable_ssl_verification
,
type:
Boolean
,
desc:
"Do SSL verification when triggering the hook"
optional
:enable_ssl_verification
,
type:
Boolean
,
desc:
"Do SSL verification when triggering the hook"
end
end
post
do
post
do
...
...
spec/requests/api/system_hooks_spec.rb
View file @
2a0a7b42
...
@@ -36,6 +36,7 @@ describe API::SystemHooks do
...
@@ -36,6 +36,7 @@ describe API::SystemHooks do
expect
(
json_response
.
first
[
'url'
]).
to
eq
(
hook
.
url
)
expect
(
json_response
.
first
[
'url'
]).
to
eq
(
hook
.
url
)
expect
(
json_response
.
first
[
'push_events'
]).
to
be
false
expect
(
json_response
.
first
[
'push_events'
]).
to
be
false
expect
(
json_response
.
first
[
'tag_push_events'
]).
to
be
false
expect
(
json_response
.
first
[
'tag_push_events'
]).
to
be
false
expect
(
json_response
.
first
[
'merge_requests_events'
]).
to
be
false
expect
(
json_response
.
first
[
'repository_update_events'
]).
to
be
true
expect
(
json_response
.
first
[
'repository_update_events'
]).
to
be
true
end
end
end
end
...
@@ -67,11 +68,28 @@ describe API::SystemHooks do
...
@@ -67,11 +68,28 @@ describe API::SystemHooks do
end
end
it
'sets default values for events'
do
it
'sets default values for events'
do
post
api
(
'/hooks'
,
admin
),
url:
'http://mep.mep'
,
enable_ssl_verification:
true
post
api
(
'/hooks'
,
admin
),
url:
'http://mep.mep'
expect
(
response
).
to
have_gitlab_http_status
(
201
)
expect
(
response
).
to
have_gitlab_http_status
(
201
)
expect
(
json_response
[
'enable_ssl_verification'
]).
to
be
true
expect
(
json_response
[
'enable_ssl_verification'
]).
to
be
true
expect
(
json_response
[
'push_events'
]).
to
be
false
expect
(
json_response
[
'tag_push_events'
]).
to
be
false
expect
(
json_response
[
'tag_push_events'
]).
to
be
false
expect
(
json_response
[
'merge_requests_events'
]).
to
be
false
end
it
'sets explicit values for events'
do
post
api
(
'/hooks'
,
admin
),
url:
'http://mep.mep'
,
enable_ssl_verification:
false
,
push_events:
true
,
tag_push_events:
true
,
merge_requests_events:
true
expect
(
response
).
to
have_http_status
(
201
)
expect
(
json_response
[
'enable_ssl_verification'
]).
to
be
false
expect
(
json_response
[
'push_events'
]).
to
be
true
expect
(
json_response
[
'tag_push_events'
]).
to
be
true
expect
(
json_response
[
'merge_requests_events'
]).
to
be
true
end
end
end
end
...
...
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