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
1165a725
Commit
1165a725
authored
Jul 26, 2017
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve conflicts in CreatePipelineService and alike
parent
c285f350
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
39 deletions
+16
-39
app/services/ci/create_pipeline_service.rb
app/services/ci/create_pipeline_service.rb
+13
-28
spec/serializers/pipeline_serializer_spec.rb
spec/serializers/pipeline_serializer_spec.rb
+1
-8
spec/support/stub_configuration.rb
spec/support/stub_configuration.rb
+2
-3
No files found.
app/services/ci/create_pipeline_service.rb
View file @
1165a725
...
...
@@ -17,47 +17,31 @@ module Ci
result
=
validate
(
current_user
||
trigger_request
.
trigger
.
owner
,
ignore_skip_ci:
ignore_skip_ci
,
save_on_errors:
save_on_errors
)
save_on_errors:
save_on_errors
,
mirror_update:
mirror_update
)
return
result
if
result
Ci
::
Pipeline
.
transaction
do
update_merge_requests_head_pipeline
if
pipeline
.
save
Ci
::
CreatePipelineStagesService
.
new
(
project
,
current_user
)
.
execute
(
pipeline
)
end
cancel_pending_pipelines
if
project
.
auto_cancel_pending_pipelines?
pipeline_created_counter
.
increment
(
source:
source
)
pipeline
.
tap
(
&
:process!
)
_create_pipeline
(
source
,
&
block
)
end
private
def
validate
(
triggering_user
,
ignore_skip_ci
:,
save_on_errors
:)
def
validate
(
triggering_user
,
ignore_skip_ci
:,
save_on_errors
:
,
mirror_update
:
)
unless
project
.
builds_enabled?
return
error
(
'Pipeline is disabled'
)
end
<<<<<<<
HEAD
unless
project
.
mirror_trigger_builds?
return
error
(
'Pipeline is disabled for mirror updates'
)
if
mirror_update
end
unless
trigger_request
||
can?
(
current_user
,
:create_pipeline
,
project
)
return
error
(
'Insufficient permissions to create a new pipeline'
)
=======
unless
allowed_to_trigger_pipeline?
(
triggering_user
)
if
can?
(
triggering_user
,
:create_pipeline
,
project
)
return
error
(
"Insufficient permissions for protected ref '
#{
ref
}
'"
)
else
return
error
(
'Insufficient permissions to create a new pipeline'
)
end
>>>>>>>
upstream
/
master
end
unless
branch?
||
tag?
...
...
@@ -85,12 +69,6 @@ module Ci
end
end
<<<<<<<
HEAD
_create_pipeline
(
source
,
&
block
)
end
private
def
_create_pipeline
(
source
)
Ci
::
Pipeline
.
transaction
do
update_merge_requests_head_pipeline
if
pipeline
.
save
...
...
@@ -100,13 +78,20 @@ module Ci
Ci
::
CreatePipelineStagesService
.
new
(
project
,
current_user
)
.
execute
(
pipeline
)
=======
end
cancel_pending_pipelines
if
project
.
auto_cancel_pending_pipelines?
pipeline_created_counter
.
increment
(
source:
source
)
pipeline
.
tap
(
&
:process!
)
end
def
allowed_to_trigger_pipeline?
(
triggering_user
)
if
triggering_user
allowed_to_create?
(
triggering_user
)
else
# legacy triggers don't have a corresponding user
!
project
.
protected_for?
(
ref
)
>>>>>>>
upstream
/
master
end
end
...
...
spec/serializers/pipeline_serializer_spec.rb
View file @
1165a725
...
...
@@ -108,16 +108,10 @@ describe PipelineSerializer do
end
end
<<<<<<<
HEAD
it
'verifies number of queries'
,
:request_store
do
recorded
=
ActiveRecord
::
QueryRecorder
.
new
{
subject
}
expect
(
recorded
.
count
).
to
be_within
(
1
).
of
(
61
)
expect
(
recorded
.
cached_count
).
to
eq
(
0
)
=======
shared_examples
'no N+1 queries'
do
it
'verifies number of queries'
,
:request_store
do
recorded
=
ActiveRecord
::
QueryRecorder
.
new
{
subject
}
expect
(
recorded
.
count
).
to
be_within
(
1
).
of
(
59
)
expect
(
recorded
.
count
).
to
be_within
(
1
).
of
(
61
)
expect
(
recorded
.
cached_count
).
to
eq
(
0
)
end
end
...
...
@@ -136,7 +130,6 @@ describe PipelineSerializer do
end
it_behaves_like
'no N+1 queries'
>>>>>>>
upstream
/
master
end
def
create_pipeline
(
status
)
...
...
spec/support/stub_configuration.rb
View file @
1165a725
...
...
@@ -9,7 +9,6 @@ module StubConfiguration
.
to
receive_messages
(
messages
)
end
<<<<<<<
HEAD
def
stub_application_setting_on_object
(
object
,
messages
)
add_predicates
(
messages
)
...
...
@@ -18,11 +17,11 @@ module StubConfiguration
messages
.
each
do
|
setting
,
value
|
allow
(
object
).
to
receive_message_chain
(
:current_application_settings
,
setting
)
{
value
}
end
=======
end
def
stub_not_protect_default_branch
stub_application_setting
(
default_branch_protection:
Gitlab
::
Access
::
PROTECTION_NONE
)
>>>>>>>
upstream
/
master
end
def
stub_config_setting
(
messages
)
...
...
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