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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
d2e9e2cc
Commit
d2e9e2cc
authored
Aug 10, 2020
by
Vladimir Shushlin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add deployment events to project hooks api
parent
9b203698
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
3 deletions
+11
-3
lib/api/entities/project_hook.rb
lib/api/entities/project_hook.rb
+1
-1
lib/api/project_hooks.rb
lib/api/project_hooks.rb
+1
-0
spec/factories/project_hooks.rb
spec/factories/project_hooks.rb
+1
-0
spec/requests/api/project_hooks_spec.rb
spec/requests/api/project_hooks_spec.rb
+8
-2
No files found.
lib/api/entities/project_hook.rb
View file @
d2e9e2cc
...
@@ -4,7 +4,7 @@ module API
...
@@ -4,7 +4,7 @@ module API
module
Entities
module
Entities
class
ProjectHook
<
Hook
class
ProjectHook
<
Hook
expose
:project_id
,
:issues_events
,
:confidential_issues_events
expose
:project_id
,
:issues_events
,
:confidential_issues_events
expose
:note_events
,
:confidential_note_events
,
:pipeline_events
,
:wiki_page_events
expose
:note_events
,
:confidential_note_events
,
:pipeline_events
,
:wiki_page_events
,
:deployment_events
expose
:job_events
expose
:job_events
expose
:push_events_branch_filter
expose
:push_events_branch_filter
end
end
...
...
lib/api/project_hooks.rb
View file @
d2e9e2cc
...
@@ -20,6 +20,7 @@ module API
...
@@ -20,6 +20,7 @@ module API
optional
:job_events
,
type:
Boolean
,
desc:
"Trigger hook on job events"
optional
:job_events
,
type:
Boolean
,
desc:
"Trigger hook on job events"
optional
:pipeline_events
,
type:
Boolean
,
desc:
"Trigger hook on pipeline events"
optional
:pipeline_events
,
type:
Boolean
,
desc:
"Trigger hook on pipeline events"
optional
:wiki_page_events
,
type:
Boolean
,
desc:
"Trigger hook on wiki events"
optional
:wiki_page_events
,
type:
Boolean
,
desc:
"Trigger hook on wiki events"
optional
:deployment_events
,
type:
Boolean
,
desc:
"Trigger hook on deployment 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"
optional
:token
,
type:
String
,
desc:
"Secret token to validate received payloads; this will not be returned in the response"
optional
:token
,
type:
String
,
desc:
"Secret token to validate received payloads; this will not be returned in the response"
optional
:push_events_branch_filter
,
type:
String
,
desc:
"Trigger hook on specified branch only"
optional
:push_events_branch_filter
,
type:
String
,
desc:
"Trigger hook on specified branch only"
...
...
spec/factories/project_hooks.rb
View file @
d2e9e2cc
...
@@ -21,6 +21,7 @@ FactoryBot.define do
...
@@ -21,6 +21,7 @@ FactoryBot.define do
job_events
{
true
}
job_events
{
true
}
pipeline_events
{
true
}
pipeline_events
{
true
}
wiki_page_events
{
true
}
wiki_page_events
{
true
}
deployment_events
{
true
}
end
end
end
end
end
end
spec/requests/api/project_hooks_spec.rb
View file @
d2e9e2cc
...
@@ -40,6 +40,7 @@ RSpec.describe API::ProjectHooks, 'ProjectHooks' do
...
@@ -40,6 +40,7 @@ RSpec.describe API::ProjectHooks, 'ProjectHooks' do
expect
(
json_response
.
first
[
'job_events'
]).
to
eq
(
true
)
expect
(
json_response
.
first
[
'job_events'
]).
to
eq
(
true
)
expect
(
json_response
.
first
[
'pipeline_events'
]).
to
eq
(
true
)
expect
(
json_response
.
first
[
'pipeline_events'
]).
to
eq
(
true
)
expect
(
json_response
.
first
[
'wiki_page_events'
]).
to
eq
(
true
)
expect
(
json_response
.
first
[
'wiki_page_events'
]).
to
eq
(
true
)
expect
(
json_response
.
first
[
'deployment_events'
]).
to
eq
(
true
)
expect
(
json_response
.
first
[
'enable_ssl_verification'
]).
to
eq
(
true
)
expect
(
json_response
.
first
[
'enable_ssl_verification'
]).
to
eq
(
true
)
expect
(
json_response
.
first
[
'push_events_branch_filter'
]).
to
eq
(
'master'
)
expect
(
json_response
.
first
[
'push_events_branch_filter'
]).
to
eq
(
'master'
)
end
end
...
@@ -71,6 +72,7 @@ RSpec.describe API::ProjectHooks, 'ProjectHooks' do
...
@@ -71,6 +72,7 @@ RSpec.describe API::ProjectHooks, 'ProjectHooks' do
expect
(
json_response
[
'job_events'
]).
to
eq
(
hook
.
job_events
)
expect
(
json_response
[
'job_events'
]).
to
eq
(
hook
.
job_events
)
expect
(
json_response
[
'pipeline_events'
]).
to
eq
(
hook
.
pipeline_events
)
expect
(
json_response
[
'pipeline_events'
]).
to
eq
(
hook
.
pipeline_events
)
expect
(
json_response
[
'wiki_page_events'
]).
to
eq
(
hook
.
wiki_page_events
)
expect
(
json_response
[
'wiki_page_events'
]).
to
eq
(
hook
.
wiki_page_events
)
expect
(
json_response
[
'deployment_events'
]).
to
eq
(
true
)
expect
(
json_response
[
'enable_ssl_verification'
]).
to
eq
(
hook
.
enable_ssl_verification
)
expect
(
json_response
[
'enable_ssl_verification'
]).
to
eq
(
hook
.
enable_ssl_verification
)
end
end
...
@@ -92,8 +94,11 @@ RSpec.describe API::ProjectHooks, 'ProjectHooks' do
...
@@ -92,8 +94,11 @@ RSpec.describe API::ProjectHooks, 'ProjectHooks' do
describe
"POST /projects/:id/hooks"
do
describe
"POST /projects/:id/hooks"
do
it
"adds hook to project"
do
it
"adds hook to project"
do
expect
do
expect
do
post
api
(
"/projects/
#{
project
.
id
}
/hooks"
,
user
),
post
(
api
(
"/projects/
#{
project
.
id
}
/hooks"
,
user
),
params:
{
url:
"http://example.com"
,
issues_events:
true
,
confidential_issues_events:
true
,
wiki_page_events:
true
,
job_events:
true
,
push_events_branch_filter:
'some-feature-branch'
}
params:
{
url:
"http://example.com"
,
issues_events:
true
,
confidential_issues_events:
true
,
wiki_page_events:
true
,
job_events:
true
,
deployment_events:
true
,
push_events_branch_filter:
'some-feature-branch'
})
end
.
to
change
{
project
.
hooks
.
count
}.
by
(
1
)
end
.
to
change
{
project
.
hooks
.
count
}.
by
(
1
)
expect
(
response
).
to
have_gitlab_http_status
(
:created
)
expect
(
response
).
to
have_gitlab_http_status
(
:created
)
...
@@ -108,6 +113,7 @@ RSpec.describe API::ProjectHooks, 'ProjectHooks' do
...
@@ -108,6 +113,7 @@ RSpec.describe API::ProjectHooks, 'ProjectHooks' do
expect
(
json_response
[
'job_events'
]).
to
eq
(
true
)
expect
(
json_response
[
'job_events'
]).
to
eq
(
true
)
expect
(
json_response
[
'pipeline_events'
]).
to
eq
(
false
)
expect
(
json_response
[
'pipeline_events'
]).
to
eq
(
false
)
expect
(
json_response
[
'wiki_page_events'
]).
to
eq
(
true
)
expect
(
json_response
[
'wiki_page_events'
]).
to
eq
(
true
)
expect
(
json_response
[
'deployment_events'
]).
to
eq
(
true
)
expect
(
json_response
[
'enable_ssl_verification'
]).
to
eq
(
true
)
expect
(
json_response
[
'enable_ssl_verification'
]).
to
eq
(
true
)
expect
(
json_response
[
'push_events_branch_filter'
]).
to
eq
(
'some-feature-branch'
)
expect
(
json_response
[
'push_events_branch_filter'
]).
to
eq
(
'some-feature-branch'
)
expect
(
json_response
).
not_to
include
(
'token'
)
expect
(
json_response
).
not_to
include
(
'token'
)
...
...
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