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
7759bb28
Commit
7759bb28
authored
Sep 28, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve conflicts in create pipeline service
parent
74c11b1c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
64 deletions
+7
-64
app/services/ci/create_pipeline_service.rb
app/services/ci/create_pipeline_service.rb
+3
-64
lib/gitlab/ci/pipeline/chain/validate/abilities.rb
lib/gitlab/ci/pipeline/chain/validate/abilities.rb
+4
-0
No files found.
app/services/ci/create_pipeline_service.rb
View file @
7759bb28
...
...
@@ -2,17 +2,13 @@ module Ci
class
CreatePipelineService
<
BaseService
attr_reader
:pipeline
<<<<<<<
HEAD
def
execute
(
source
,
ignore_skip_ci:
false
,
save_on_errors:
true
,
trigger_request:
nil
,
schedule:
nil
,
mirror_update:
false
)
=======
SEQUENCE
=
[
Gitlab
::
Ci
::
Pipeline
::
Chain
::
Validate
::
Abilities
,
Gitlab
::
Ci
::
Pipeline
::
Chain
::
Validate
::
Repository
,
Gitlab
::
Ci
::
Pipeline
::
Chain
::
Validate
::
Config
,
Gitlab
::
Ci
::
Pipeline
::
Chain
::
Skip
,
Gitlab
::
Ci
::
Pipeline
::
Chain
::
Create
].
freeze
def
execute
(
source
,
ignore_skip_ci:
false
,
save_on_errors:
true
,
trigger_request:
nil
,
schedule:
nil
,
&
block
)
>>>>>>>
upstream
/
master
def
execute
(
source
,
ignore_skip_ci:
false
,
save_on_errors:
true
,
trigger_request:
nil
,
schedule:
nil
,
mirror_update:
false
,
&
block
)
@pipeline
=
Ci
::
Pipeline
.
new
(
source:
source
,
project:
project
,
...
...
@@ -26,17 +22,13 @@ module Ci
protected:
project
.
protected_for?
(
ref
)
)
<<<<<<<
HEAD
result
=
validate_project_and_git_items
(
mirror_update:
mirror_update
)
||
validate_pipeline
(
ignore_skip_ci:
ignore_skip_ci
,
save_on_errors:
save_on_errors
)
=======
# VALIDATE mirror_update!
command
=
OpenStruct
.
new
(
ignore_skip_ci:
ignore_skip_ci
,
save_incompleted:
save_on_errors
,
allow_mirror_update:
mirror_update
,
seeds_block:
block
,
project:
project
,
current_user:
current_user
)
>>>>>>>
upstream
/
master
sequence
=
Gitlab
::
Ci
::
Pipeline
::
Chain
::
Sequence
.
new
(
pipeline
,
command
,
SEQUENCE
)
...
...
@@ -55,61 +47,8 @@ module Ci
private
<<<<<<<
HEAD
def
validate_project_and_git_items
(
mirror_update:
false
)
unless
project
.
builds_enabled?
return
error
(
'Pipeline is disabled'
)
end
if
mirror_update
&&
!
project
.
mirror_trigger_builds?
return
error
(
'Pipeline is disabled for mirror updates'
)
end
unless
allowed_to_trigger_pipeline?
if
can?
(
current_user
,
:create_pipeline
,
project
)
return
error
(
"Insufficient permissions for protected ref '
#{
ref
}
'"
)
else
return
error
(
'Insufficient permissions to create a new pipeline'
)
end
end
unless
branch?
||
tag?
return
error
(
'Reference not found'
)
end
unless
commit
return
error
(
'Commit not found'
)
end
end
def
validate_pipeline
(
ignore_skip_ci
:,
save_on_errors
:)
unless
pipeline
.
config_processor
unless
pipeline
.
ci_yaml_file
return
error
(
"Missing
#{
pipeline
.
ci_yaml_file_path
}
file"
)
end
return
error
(
pipeline
.
yaml_errors
,
save:
save_on_errors
)
end
if
!
ignore_skip_ci
&&
skip_ci?
pipeline
.
skip
if
save_on_errors
return
pipeline
end
unless
pipeline
.
has_stage_seeds?
return
error
(
'No stages / jobs for this pipeline.'
)
end
end
def
allowed_to_trigger_pipeline?
if
current_user
allowed_to_create?
else
# legacy triggers don't have a corresponding user
!
project
.
protected_for?
(
ref
)
end
=======
def
commit
@commit
||=
project
.
commit
(
origin_sha
||
origin_ref
)
>>>>>>>
upstream
/
master
end
def
sha
...
...
lib/gitlab/ci/pipeline/chain/validate/abilities.rb
View file @
7759bb28
...
...
@@ -12,6 +12,10 @@ module Gitlab
return
error
(
'Pipelines are disabled!'
)
end
if
@command
.
allow_mirror_update
&&
!
project
.
mirror_trigger_builds?
return
error
(
'Pipeline is disabled for mirror updates'
)
end
unless
allowed_to_trigger_pipeline?
if
can?
(
current_user
,
:create_pipeline
,
project
)
return
error
(
"Insufficient permissions for protected ref '
#{
pipeline
.
ref
}
'"
)
...
...
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