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
950fa32a
Commit
950fa32a
authored
May 15, 2017
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Merge branch 'bvl-rename-build-events-to-job-events' into 'master'"
This reverts merge request !11287
parent
ffabab80
Changes
25
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
121 additions
and
125 deletions
+121
-125
app/models/ci/build.rb
app/models/ci/build.rb
+2
-2
app/models/hooks/project_hook.rb
app/models/hooks/project_hook.rb
+1
-1
app/models/hooks/web_hook.rb
app/models/hooks/web_hook.rb
+1
-1
app/models/service.rb
app/models/service.rb
+2
-2
app/views/admin/hooks/index.html.haml
app/views/admin/hooks/index.html.haml
+1
-1
app/views/projects/settings/integrations/_project_hook.html.haml
...ws/projects/settings/integrations/_project_hook.html.haml
+1
-1
app/views/shared/web_hooks/_form.html.haml
app/views/shared/web_hooks/_form.html.haml
+3
-3
changelogs/unreleased/bvl-rename-build-events-to-job-events.yml
...logs/unreleased/bvl-rename-build-events-to-job-events.yml
+0
-4
db/migrate/20170511082759_rename_web_hooks_build_events_to_job_events.rb
...0511082759_rename_web_hooks_build_events_to_job_events.rb
+0
-18
db/migrate/20170511083824_rename_services_build_events_to_job_events.rb
...70511083824_rename_services_build_events_to_job_events.rb
+0
-18
db/post_migrate/20170511100900_cleanup_rename_web_hooks_build_events_to_job_events.rb
...00_cleanup_rename_web_hooks_build_events_to_job_events.rb
+0
-18
db/post_migrate/20170511101000_cleanup_rename_services_build_events_to_job_events.rb
...000_cleanup_rename_services_build_events_to_job_events.rb
+0
-18
db/schema.rb
db/schema.rb
+3
-3
doc/api/services.md
doc/api/services.md
+1
-1
lib/api/entities.rb
lib/api/entities.rb
+2
-2
lib/api/project_hooks.rb
lib/api/project_hooks.rb
+2
-0
lib/api/v3/entities.rb
lib/api/v3/entities.rb
+2
-4
spec/factories/project_hooks.rb
spec/factories/project_hooks.rb
+1
-1
spec/features/projects/settings/integration_settings_spec.rb
spec/features/projects/settings/integration_settings_spec.rb
+0
-2
spec/lib/gitlab/import_export/project.json
spec/lib/gitlab/import_export/project.json
+18
-18
spec/lib/gitlab/import_export/relation_factory_spec.rb
spec/lib/gitlab/import_export/relation_factory_spec.rb
+1
-1
spec/lib/gitlab/import_export/safe_model_attributes.yml
spec/lib/gitlab/import_export/safe_model_attributes.yml
+2
-2
spec/migrations/migrate_build_events_to_pipeline_events_spec.rb
...igrations/migrate_build_events_to_pipeline_events_spec.rb
+74
-0
spec/requests/api/project_hooks_spec.rb
spec/requests/api/project_hooks_spec.rb
+2
-2
spec/requests/api/v3/project_hooks_spec.rb
spec/requests/api/v3/project_hooks_spec.rb
+2
-2
No files found.
app/models/ci/build.rb
View file @
950fa32a
...
...
@@ -300,8 +300,8 @@ module Ci
def
execute_hooks
return
unless
project
build_data
=
Gitlab
::
DataBuilder
::
Build
.
build
(
self
)
project
.
execute_hooks
(
build_data
.
dup
,
:
job
_hooks
)
project
.
execute_services
(
build_data
.
dup
,
:
job
_hooks
)
project
.
execute_hooks
(
build_data
.
dup
,
:
build
_hooks
)
project
.
execute_services
(
build_data
.
dup
,
:
build
_hooks
)
PagesService
.
new
(
build_data
).
execute
project
.
running_or_pending_build_count
(
force:
true
)
end
...
...
app/models/hooks/project_hook.rb
View file @
950fa32a
...
...
@@ -5,7 +5,7 @@ class ProjectHook < WebHook
scope
:confidential_issue_hooks
,
->
{
where
(
confidential_issues_events:
true
)
}
scope
:note_hooks
,
->
{
where
(
note_events:
true
)
}
scope
:merge_request_hooks
,
->
{
where
(
merge_requests_events:
true
)
}
scope
:
job_hooks
,
->
{
where
(
job
_events:
true
)
}
scope
:
build_hooks
,
->
{
where
(
build
_events:
true
)
}
scope
:pipeline_hooks
,
->
{
where
(
pipeline_events:
true
)
}
scope
:wiki_page_hooks
,
->
{
where
(
wiki_page_events:
true
)
}
end
app/models/hooks/web_hook.rb
View file @
950fa32a
...
...
@@ -8,7 +8,7 @@ class WebHook < ActiveRecord::Base
default_value_for
:note_events
,
false
default_value_for
:merge_requests_events
,
false
default_value_for
:tag_push_events
,
false
default_value_for
:
job
_events
,
false
default_value_for
:
build
_events
,
false
default_value_for
:pipeline_events
,
false
default_value_for
:repository_update_events
,
false
default_value_for
:enable_ssl_verification
,
true
...
...
app/models/service.rb
View file @
950fa32a
...
...
@@ -12,7 +12,7 @@ class Service < ActiveRecord::Base
default_value_for
:merge_requests_events
,
true
default_value_for
:tag_push_events
,
true
default_value_for
:note_events
,
true
default_value_for
:
job
_events
,
true
default_value_for
:
build
_events
,
true
default_value_for
:pipeline_events
,
true
default_value_for
:wiki_page_events
,
true
...
...
@@ -40,7 +40,7 @@ class Service < ActiveRecord::Base
scope
:confidential_issue_hooks
,
->
{
where
(
confidential_issues_events:
true
,
active:
true
)
}
scope
:merge_request_hooks
,
->
{
where
(
merge_requests_events:
true
,
active:
true
)
}
scope
:note_hooks
,
->
{
where
(
note_events:
true
,
active:
true
)
}
scope
:
job_hooks
,
->
{
where
(
job
_events:
true
,
active:
true
)
}
scope
:
build_hooks
,
->
{
where
(
build
_events:
true
,
active:
true
)
}
scope
:pipeline_hooks
,
->
{
where
(
pipeline_events:
true
,
active:
true
)
}
scope
:wiki_page_hooks
,
->
{
where
(
wiki_page_events:
true
,
active:
true
)
}
scope
:external_issue_trackers
,
->
{
issue_trackers
.
active
.
without_defaults
}
...
...
app/views/admin/hooks/index.html.haml
View file @
950fa32a
...
...
@@ -27,7 +27,7 @@
=
link_to
'Remove'
,
admin_hook_path
(
hook
),
data:
{
confirm:
'Are you sure?'
},
method: :delete
,
class:
'btn btn-remove btn-sm'
.monospace
=
hook
.
url
%div
-
%w(repository_update_events push_events tag_push_events issues_events note_events merge_requests_events
job
_events)
.
each
do
|
trigger
|
-
%w(repository_update_events push_events tag_push_events issues_events note_events merge_requests_events
build
_events)
.
each
do
|
trigger
|
-
if
hook
.
send
(
trigger
)
%span
.label.label-gray
=
trigger
.
titleize
%span
.label.label-gray
SSL Verification:
#{
hook
.
enable_ssl_verification
?
'enabled'
:
'disabled'
}
app/views/projects/settings/integrations/_project_hook.html.haml
View file @
950fa32a
...
...
@@ -3,7 +3,7 @@
.col-md-8.col-lg-7
%strong
.light-header
=
hook
.
url
%div
-
%w(push_events tag_push_events issues_events confidential_issues_events note_events merge_requests_events
job
_events pipeline_events wiki_page_events)
.
each
do
|
trigger
|
-
%w(push_events tag_push_events issues_events confidential_issues_events note_events merge_requests_events
build
_events pipeline_events wiki_page_events)
.
each
do
|
trigger
|
-
if
hook
.
send
(
trigger
)
%span
.label.label-gray.deploy-project-label
=
trigger
.
titleize
.col-md-4.col-lg-5.text-right-lg.prepend-top-5
...
...
app/views/shared/web_hooks/_form.html.haml
View file @
950fa32a
...
...
@@ -54,10 +54,10 @@
%p
.light
This URL will be triggered when a merge request is created/updated/merged
%li
=
form
.
check_box
:
job
_events
,
class:
'pull-left'
=
form
.
check_box
:
build
_events
,
class:
'pull-left'
.prepend-left-20
=
form
.
label
:
job
_events
,
class:
'list-label'
do
%strong
Job events
=
form
.
label
:
build
_events
,
class:
'list-label'
do
%strong
Job
s
events
%p
.light
This URL will be triggered when the job status changes
%li
...
...
changelogs/unreleased/bvl-rename-build-events-to-job-events.yml
deleted
100644 → 0
View file @
ffabab80
---
title
:
Rename build_events to job_events
merge_request
:
11287
author
:
db/migrate/20170511082759_rename_web_hooks_build_events_to_job_events.rb
deleted
100644 → 0
View file @
ffabab80
# See http://doc.gitlab.com/ce/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.
class
RenameWebHooksBuildEventsToJobEvents
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
disable_ddl_transaction!
def
up
rename_column_concurrently
:web_hooks
,
:build_events
,
:job_events
end
def
down
cleanup_concurrent_column_rename
:web_hooks
,
:job_events
,
:build_events
end
end
db/migrate/20170511083824_rename_services_build_events_to_job_events.rb
deleted
100644 → 0
View file @
ffabab80
# See http://doc.gitlab.com/ce/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.
class
RenameServicesBuildEventsToJobEvents
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
disable_ddl_transaction!
def
up
rename_column_concurrently
:services
,
:build_events
,
:job_events
end
def
down
cleanup_concurrent_column_rename
:services
,
:job_events
,
:build_events
end
end
db/post_migrate/20170511100900_cleanup_rename_web_hooks_build_events_to_job_events.rb
deleted
100644 → 0
View file @
ffabab80
# See http://doc.gitlab.com/ce/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.
class
CleanupRenameWebHooksBuildEventsToJobEvents
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
disable_ddl_transaction!
def
up
cleanup_concurrent_column_rename
:web_hooks
,
:build_events
,
:job_events
end
def
down
rename_column_concurrently
:web_hooks
,
:job_events
,
:build_events
end
end
db/post_migrate/20170511101000_cleanup_rename_services_build_events_to_job_events.rb
deleted
100644 → 0
View file @
ffabab80
# See http://doc.gitlab.com/ce/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.
class
CleanupRenameServicesBuildEventsToJobEvents
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
disable_ddl_transaction!
def
up
cleanup_concurrent_column_rename
:services
,
:build_events
,
:job_events
end
def
down
rename_column_concurrently
:services
,
:job_events
,
:build_events
end
end
db/schema.rb
View file @
950fa32a
...
...
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
201705
11101000
)
do
ActiveRecord
::
Schema
.
define
(
version:
201705
08190732
)
do
# These are extensions that must be enabled in order to support this database
enable_extension
"plpgsql"
...
...
@@ -1125,13 +1125,13 @@ ActiveRecord::Schema.define(version: 20170511101000) do
t
.
boolean
"merge_requests_events"
,
default:
true
t
.
boolean
"tag_push_events"
,
default:
true
t
.
boolean
"note_events"
,
default:
true
,
null:
false
t
.
boolean
"build_events"
,
default:
false
,
null:
false
t
.
string
"category"
,
default:
"common"
,
null:
false
t
.
boolean
"default"
,
default:
false
t
.
boolean
"wiki_page_events"
,
default:
true
t
.
boolean
"pipeline_events"
,
default:
false
,
null:
false
t
.
boolean
"confidential_issues_events"
,
default:
true
,
null:
false
t
.
boolean
"commit_events"
,
default:
true
,
null:
false
t
.
boolean
"job_events"
,
default:
false
,
null:
false
end
add_index
"services"
,
[
"project_id"
],
name:
"index_services_on_project_id"
,
using: :btree
...
...
@@ -1401,11 +1401,11 @@ ActiveRecord::Schema.define(version: 20170511101000) do
t
.
boolean
"tag_push_events"
,
default:
false
t
.
boolean
"note_events"
,
default:
false
,
null:
false
t
.
boolean
"enable_ssl_verification"
,
default:
true
t
.
boolean
"build_events"
,
default:
false
,
null:
false
t
.
boolean
"wiki_page_events"
,
default:
false
,
null:
false
t
.
string
"token"
t
.
boolean
"pipeline_events"
,
default:
false
,
null:
false
t
.
boolean
"confidential_issues_events"
,
default:
false
,
null:
false
t
.
boolean
"job_events"
,
default:
false
,
null:
false
t
.
boolean
"repository_update_events"
,
default:
false
,
null:
false
end
...
...
doc/api/services.md
View file @
950fa32a
...
...
@@ -516,7 +516,7 @@ Example response:
"merge_requests_events"
:
true
,
"tag_push_events"
:
true
,
"note_events"
:
true
,
"
job
_events"
:
true
,
"
build
_events"
:
true
,
"pipeline_events"
:
true
,
"properties"
:
{
"token"
:
"9koXpg98eAheJpvBs5tK"
...
...
lib/api/entities.rb
View file @
950fa32a
...
...
@@ -60,7 +60,7 @@ module API
class
ProjectHook
<
Hook
expose
:project_id
,
:issues_events
,
:merge_requests_events
expose
:note_events
,
:pipeline_events
,
:wiki_page_events
expose
:job_events
expose
:
build_events
,
as: :
job_events
end
class
BasicProjectDetails
<
Grape
::
Entity
...
...
@@ -470,7 +470,7 @@ module API
expose
:id
,
:title
,
:created_at
,
:updated_at
,
:active
expose
:push_events
,
:issues_events
,
:merge_requests_events
expose
:tag_push_events
,
:note_events
,
:pipeline_events
expose
:job_events
expose
:
build_events
,
as: :
job_events
# Expose serialized properties
expose
:properties
do
|
service
,
options
|
field_names
=
service
.
fields
.
...
...
lib/api/project_hooks.rb
View file @
950fa32a
...
...
@@ -54,6 +54,7 @@ module API
end
post
":id/hooks"
do
hook_params
=
declared_params
(
include_missing:
false
)
hook_params
[
:build_events
]
=
hook_params
.
delete
(
:job_events
)
{
false
}
hook
=
user_project
.
hooks
.
new
(
hook_params
)
...
...
@@ -77,6 +78,7 @@ module API
hook
=
user_project
.
hooks
.
find
(
params
.
delete
(
:hook_id
))
update_params
=
declared_params
(
include_missing:
false
)
update_params
[
:build_events
]
=
update_params
.
delete
(
:job_events
)
if
update_params
[
:job_events
]
if
hook
.
update_attributes
(
update_params
)
present
hook
,
with:
Entities
::
ProjectHook
...
...
lib/api/v3/entities.rb
View file @
950fa32a
...
...
@@ -238,8 +238,7 @@ module API
class
ProjectService
<
Grape
::
Entity
expose
:id
,
:title
,
:created_at
,
:updated_at
,
:active
expose
:push_events
,
:issues_events
,
:merge_requests_events
expose
:tag_push_events
,
:note_events
,
:pipeline_events
expose
:job_events
,
as: :build_events
expose
:tag_push_events
,
:note_events
,
:build_events
,
:pipeline_events
# Expose serialized properties
expose
:properties
do
|
service
,
options
|
field_names
=
service
.
fields
.
...
...
@@ -251,8 +250,7 @@ module API
class
ProjectHook
<
::
API
::
Entities
::
Hook
expose
:project_id
,
:issues_events
,
:merge_requests_events
expose
:note_events
,
:pipeline_events
,
:wiki_page_events
expose
:job_events
,
as: :build_events
expose
:note_events
,
:build_events
,
:pipeline_events
,
:wiki_page_events
end
class
Issue
<
::
API
::
Entities
::
Issue
...
...
spec/factories/project_hooks.rb
View file @
950fa32a
...
...
@@ -14,7 +14,7 @@ FactoryGirl.define do
issues_events
true
confidential_issues_events
true
note_events
true
job
_events
true
build
_events
true
pipeline_events
true
wiki_page_events
true
end
...
...
spec/features/projects/settings/integration_settings_spec.rb
View file @
950fa32a
...
...
@@ -52,7 +52,6 @@ feature 'Integration settings', feature: true do
fill_in
'hook_url'
,
with:
url
check
'Tag push events'
check
'Enable SSL verification'
check
'Job events'
click_button
'Add webhook'
...
...
@@ -60,7 +59,6 @@ feature 'Integration settings', feature: true do
expect
(
page
).
to
have_content
(
'SSL Verification: enabled'
)
expect
(
page
).
to
have_content
(
'Push Events'
)
expect
(
page
).
to
have_content
(
'Tag Push Events'
)
expect
(
page
).
to
have_content
(
'Job events'
)
end
scenario
'edit existing webhook'
do
...
...
spec/lib/gitlab/import_export/project.json
View file @
950fa32a
...
...
@@ -6997,7 +6997,7 @@
"merge_requests_events"
:
true
,
"tag_push_events"
:
true
,
"note_events"
:
true
,
"
job
_events"
:
true
,
"
build
_events"
:
true
,
"type"
:
"TeamcityService"
,
"category"
:
"ci"
,
"default"
:
false
,
...
...
@@ -7041,7 +7041,7 @@
"merge_requests_events"
:
true
,
"tag_push_events"
:
true
,
"note_events"
:
true
,
"
job
_events"
:
true
,
"
build
_events"
:
true
,
"type"
:
"RedmineService"
,
"category"
:
"issue_tracker"
,
"default"
:
false
,
...
...
@@ -7063,7 +7063,7 @@
"merge_requests_events"
:
true
,
"tag_push_events"
:
true
,
"note_events"
:
true
,
"
job
_events"
:
true
,
"
build
_events"
:
true
,
"type"
:
"PushoverService"
,
"category"
:
"common"
,
"default"
:
false
,
...
...
@@ -7085,7 +7085,7 @@
"merge_requests_events"
:
true
,
"tag_push_events"
:
true
,
"note_events"
:
true
,
"
job
_events"
:
true
,
"
build
_events"
:
true
,
"type"
:
"PivotalTrackerService"
,
"category"
:
"common"
,
"default"
:
false
,
...
...
@@ -7108,7 +7108,7 @@
"merge_requests_events"
:
true
,
"tag_push_events"
:
true
,
"note_events"
:
true
,
"
job
_events"
:
true
,
"
build
_events"
:
true
,
"type"
:
"JiraService"
,
"category"
:
"issue_tracker"
,
"default"
:
false
,
...
...
@@ -7130,7 +7130,7 @@
"merge_requests_events"
:
true
,
"tag_push_events"
:
true
,
"note_events"
:
true
,
"
job
_events"
:
true
,
"
build
_events"
:
true
,
"type"
:
"IrkerService"
,
"category"
:
"common"
,
"default"
:
false
,
...
...
@@ -7174,7 +7174,7 @@
"merge_requests_events"
:
true
,
"tag_push_events"
:
true
,
"note_events"
:
true
,
"
job
_events"
:
true
,
"
build
_events"
:
true
,
"type"
:
"GemnasiumService"
,
"category"
:
"common"
,
"default"
:
false
,
...
...
@@ -7196,7 +7196,7 @@
"merge_requests_events"
:
true
,
"tag_push_events"
:
true
,
"note_events"
:
true
,
"
job
_events"
:
true
,
"
build
_events"
:
true
,
"type"
:
"FlowdockService"
,
"category"
:
"common"
,
"default"
:
false
,
...
...
@@ -7218,7 +7218,7 @@
"merge_requests_events"
:
true
,
"tag_push_events"
:
true
,
"note_events"
:
true
,
"
job
_events"
:
true
,
"
build
_events"
:
true
,
"type"
:
"ExternalWikiService"
,
"category"
:
"common"
,
"default"
:
false
,
...
...
@@ -7240,7 +7240,7 @@
"merge_requests_events"
:
true
,
"tag_push_events"
:
true
,
"note_events"
:
true
,
"
job
_events"
:
true
,
"
build
_events"
:
true
,
"type"
:
"EmailsOnPushService"
,
"category"
:
"common"
,
"default"
:
false
,
...
...
@@ -7262,7 +7262,7 @@
"merge_requests_events"
:
true
,
"tag_push_events"
:
true
,
"note_events"
:
true
,
"
job
_events"
:
true
,
"
build
_events"
:
true
,
"type"
:
"DroneCiService"
,
"category"
:
"ci"
,
"default"
:
false
,
...
...
@@ -7284,7 +7284,7 @@
"merge_requests_events"
:
true
,
"tag_push_events"
:
true
,
"note_events"
:
true
,
"
job
_events"
:
true
,
"
build
_events"
:
true
,
"type"
:
"CustomIssueTrackerService"
,
"category"
:
"issue_tracker"
,
"default"
:
false
,
...
...
@@ -7306,7 +7306,7 @@
"merge_requests_events"
:
true
,
"tag_push_events"
:
true
,
"note_events"
:
true
,
"
job
_events"
:
true
,
"
build
_events"
:
true
,
"type"
:
"CampfireService"
,
"category"
:
"common"
,
"default"
:
false
,
...
...
@@ -7328,7 +7328,7 @@
"merge_requests_events"
:
true
,
"tag_push_events"
:
true
,
"note_events"
:
true
,
"
job
_events"
:
true
,
"
build
_events"
:
true
,
"type"
:
"BuildkiteService"
,
"category"
:
"ci"
,
"default"
:
false
,
...
...
@@ -7350,7 +7350,7 @@
"merge_requests_events"
:
true
,
"tag_push_events"
:
true
,
"note_events"
:
true
,
"
job
_events"
:
true
,
"
build
_events"
:
true
,
"type"
:
"BambooService"
,
"category"
:
"ci"
,
"default"
:
false
,
...
...
@@ -7372,7 +7372,7 @@
"merge_requests_events"
:
true
,
"tag_push_events"
:
true
,
"note_events"
:
true
,
"
job
_events"
:
true
,
"
build
_events"
:
true
,
"type"
:
"AssemblaService"
,
"category"
:
"common"
,
"default"
:
false
,
...
...
@@ -7394,7 +7394,7 @@
"merge_requests_events"
:
true
,
"tag_push_events"
:
true
,
"note_events"
:
true
,
"
job
_events"
:
true
,
"
build
_events"
:
true
,
"type"
:
"AssemblaService"
,
"category"
:
"common"
,
"default"
:
false
,
...
...
@@ -7416,7 +7416,7 @@
"merge_requests_events"
:
true
,
"tag_push_events"
:
true
,
"note_events"
:
true
,
"
job
_events"
:
true
,
"
build
_events"
:
true
,
"category"
:
"common"
,
"default"
:
false
,
"wiki_page_events"
:
true
,
...
...
spec/lib/gitlab/import_export/relation_factory_spec.rb
View file @
950fa32a
...
...
@@ -33,7 +33,7 @@ describe Gitlab::ImportExport::RelationFactory, lib: true do
'tag_push_events'
=>
false
,
'note_events'
=>
true
,
'enable_ssl_verification'
=>
true
,
'
job
_events'
=>
false
,
'
build
_events'
=>
false
,
'wiki_page_events'
=>
true
,
'token'
=>
token
}
...
...
spec/lib/gitlab/import_export/safe_model_attributes.yml
View file @
950fa32a
...
...
@@ -292,7 +292,7 @@ Service:
-
tag_push_events
-
note_events
-
pipeline_events
-
job
_events
-
build
_events
-
category
-
default
-
wiki_page_events
...
...
@@ -312,7 +312,7 @@ ProjectHook:
-
note_events
-
pipeline_events
-
enable_ssl_verification
-
job
_events
-
build
_events
-
wiki_page_events
-
token
-
group_id
...
...
spec/migrations/migrate_build_events_to_pipeline_events_spec.rb
0 → 100644
View file @
950fa32a
require
'spec_helper'
require
Rails
.
root
.
join
(
'db'
,
'post_migrate'
,
'20170301205640_migrate_build_events_to_pipeline_events.rb'
)
# This migration uses multiple threads, and thus different transactions. This
# means data created in this spec may not be visible to some threads. To work
# around this we use the TRUNCATE cleaning strategy.
describe
MigrateBuildEventsToPipelineEvents
,
truncate:
true
do
let
(
:migration
)
{
described_class
.
new
}
let
(
:project_with_pipeline_service
)
{
create
(
:empty_project
)
}
let
(
:project_with_build_service
)
{
create
(
:empty_project
)
}
before
do
ActiveRecord
::
Base
.
connection
.
execute
<<-
SQL
INSERT INTO services (properties, build_events, pipeline_events, type)
VALUES
('{"notify_only_broken_builds":true}', true, false, 'SlackService')
, ('{"notify_only_broken_builds":true}', true, false, 'MattermostService')
, ('{"notify_only_broken_builds":true}', true, false, 'HipchatService')
;
SQL
ActiveRecord
::
Base
.
connection
.
execute
<<-
SQL
INSERT INTO services
(properties, build_events, pipeline_events, type, project_id)
VALUES
('{"notify_only_broken_builds":true}', true, false,
'BuildsEmailService',
#{
project_with_pipeline_service
.
id
}
)
, ('{"notify_only_broken_pipelines":true}', false, true,
'PipelinesEmailService',
#{
project_with_pipeline_service
.
id
}
)
, ('{"notify_only_broken_builds":true}', true, false,
'BuildsEmailService',
#{
project_with_build_service
.
id
}
)
;
SQL
end
describe
'#up'
do
before
do
silence_migration
=
Module
.
new
do
# rubocop:disable Rails/Delegate
def
execute
(
query
)
connection
.
execute
(
query
)
end
end
migration
.
extend
(
silence_migration
)
migration
.
up
end
it
'migrates chat service properly'
do
[
SlackService
,
MattermostService
,
HipchatService
].
each
do
|
service
|
expect
(
service
.
count
).
to
eq
(
1
)
verify_service_record
(
service
.
first
)
end
end
it
'migrates pipelines email service only if it has none before'
do
Project
.
find_each
do
|
project
|
pipeline_service_count
=
project
.
services
.
where
(
type:
'PipelinesEmailService'
).
count
expect
(
pipeline_service_count
).
to
eq
(
1
)
verify_service_record
(
project
.
pipelines_email_service
)
end
end
def
verify_service_record
(
service
)
expect
(
service
.
notify_only_broken_pipelines
).
to
be
(
true
)
expect
(
service
.
build_events
).
to
be
(
false
)
expect
(
service
.
pipeline_events
).
to
be
(
true
)
end
end
end
spec/requests/api/project_hooks_spec.rb
View file @
950fa32a
...
...
@@ -60,7 +60,7 @@ describe API::ProjectHooks, 'ProjectHooks' do
expect
(
json_response
[
'merge_requests_events'
]).
to
eq
(
hook
.
merge_requests_events
)
expect
(
json_response
[
'tag_push_events'
]).
to
eq
(
hook
.
tag_push_events
)
expect
(
json_response
[
'note_events'
]).
to
eq
(
hook
.
note_events
)
expect
(
json_response
[
'job_events'
]).
to
eq
(
hook
.
job
_events
)
expect
(
json_response
[
'job_events'
]).
to
eq
(
hook
.
build
_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
[
'enable_ssl_verification'
]).
to
eq
(
hook
.
enable_ssl_verification
)
...
...
@@ -148,7 +148,7 @@ describe API::ProjectHooks, 'ProjectHooks' do
expect
(
json_response
[
'merge_requests_events'
]).
to
eq
(
hook
.
merge_requests_events
)
expect
(
json_response
[
'tag_push_events'
]).
to
eq
(
hook
.
tag_push_events
)
expect
(
json_response
[
'note_events'
]).
to
eq
(
hook
.
note_events
)
expect
(
json_response
[
'job_events'
]).
to
eq
(
hook
.
job
_events
)
expect
(
json_response
[
'job_events'
]).
to
eq
(
hook
.
build
_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
[
'enable_ssl_verification'
]).
to
eq
(
hook
.
enable_ssl_verification
)
...
...
spec/requests/api/v3/project_hooks_spec.rb
View file @
950fa32a
...
...
@@ -58,7 +58,7 @@ describe API::ProjectHooks, 'ProjectHooks' do
expect
(
json_response
[
'merge_requests_events'
]).
to
eq
(
hook
.
merge_requests_events
)
expect
(
json_response
[
'tag_push_events'
]).
to
eq
(
hook
.
tag_push_events
)
expect
(
json_response
[
'note_events'
]).
to
eq
(
hook
.
note_events
)
expect
(
json_response
[
'build_events'
]).
to
eq
(
hook
.
job
_events
)
expect
(
json_response
[
'build_events'
]).
to
eq
(
hook
.
build
_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
[
'enable_ssl_verification'
]).
to
eq
(
hook
.
enable_ssl_verification
)
...
...
@@ -143,7 +143,7 @@ describe API::ProjectHooks, 'ProjectHooks' do
expect
(
json_response
[
'merge_requests_events'
]).
to
eq
(
hook
.
merge_requests_events
)
expect
(
json_response
[
'tag_push_events'
]).
to
eq
(
hook
.
tag_push_events
)
expect
(
json_response
[
'note_events'
]).
to
eq
(
hook
.
note_events
)
expect
(
json_response
[
'build_events'
]).
to
eq
(
hook
.
job
_events
)
expect
(
json_response
[
'build_events'
]).
to
eq
(
hook
.
build
_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
[
'enable_ssl_verification'
]).
to
eq
(
hook
.
enable_ssl_verification
)
...
...
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