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
91a67a79
Commit
91a67a79
authored
Jan 03, 2019
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify cross-pipeline creation service
parent
6262b3b5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
13 deletions
+9
-13
ee/app/models/ci/sources/pipeline.rb
ee/app/models/ci/sources/pipeline.rb
+1
-1
ee/app/models/ee/ci/pipeline.rb
ee/app/models/ee/ci/pipeline.rb
+1
-1
ee/app/services/ci/create_cross_project_pipeline_service.rb
ee/app/services/ci/create_cross_project_pipeline_service.rb
+7
-11
No files found.
ee/app/models/ci/sources/pipeline.rb
View file @
91a67a79
...
...
@@ -6,7 +6,7 @@ module Ci
self
.
table_name
=
"ci_sources_pipelines"
belongs_to
:project
,
class_name:
Project
belongs_to
:pipeline
,
class_name:
Ci
::
Pipeline
belongs_to
:pipeline
,
class_name:
Ci
::
Pipeline
,
inverse_of: :source_pipeline
belongs_to
:source_project
,
class_name:
Project
,
foreign_key: :source_project_id
belongs_to
:source_job
,
class_name:
CommitStatus
,
foreign_key: :source_job_id
...
...
ee/app/models/ee/ci/pipeline.rb
View file @
91a67a79
...
...
@@ -19,7 +19,7 @@ module EE
has_many
:vulnerabilities_occurrence_pipelines
,
class_name:
'Vulnerabilities::OccurrencePipeline'
has_many
:vulnerabilities
,
source: :occurrence
,
through: :vulnerabilities_occurrence_pipelines
,
class_name:
'Vulnerabilities::Occurrence'
has_one
:source_pipeline
,
class_name:
::
Ci
::
Sources
::
Pipeline
has_one
:source_pipeline
,
class_name:
::
Ci
::
Sources
::
Pipeline
,
inverse_of: :pipeline
has_many
:sourced_pipelines
,
class_name:
::
Ci
::
Sources
::
Pipeline
,
foreign_key: :source_pipeline_id
has_one
:triggered_by_pipeline
,
through: :source_pipeline
,
source: :source_pipeline
...
...
ee/app/services/ci/create_cross_project_pipeline_service.rb
View file @
91a67a79
...
...
@@ -19,15 +19,7 @@ module Ci
return
bridge
.
drop!
(
:insufficient_bridge_permissions
)
end
create_pipeline
do
|
pipeline
|
source
=
bridge
.
sourced_pipelines
.
build
(
source_pipeline:
bridge
.
pipeline
,
source_project:
bridge
.
project
,
project:
target_project
,
pipeline:
pipeline
)
pipeline
.
source_pipeline
=
source
end
create_pipeline!
end
private
...
...
@@ -42,11 +34,15 @@ module Ci
can?
(
target_user
,
:create_pipeline
,
target_project
)
end
def
create_pipeline
def
create_pipeline
!
::
Ci
::
CreatePipelineService
.
new
(
target_project
,
target_user
,
ref:
target_ref
)
.
execute
(
:pipeline
,
ignore_skip_ci:
true
)
do
|
pipeline
|
yield
pipeline
@bridge
.
sourced_pipelines
.
build
(
source_pipeline:
@bridge
.
pipeline
,
source_project:
@bridge
.
project
,
project:
target_project
,
pipeline:
pipeline
)
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