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
46b78677
Commit
46b78677
authored
Feb 21, 2020
by
Fabio Pitino
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't create duplicate downstream pipelines
parent
46afb71c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
0 deletions
+21
-0
app/models/ci/bridge.rb
app/models/ci/bridge.rb
+4
-0
app/services/ci/create_cross_project_pipeline_service.rb
app/services/ci/create_cross_project_pipeline_service.rb
+1
-0
spec/services/ci/create_cross_project_pipeline_service_spec.rb
...services/ci/create_cross_project_pipeline_service_spec.rb
+16
-0
No files found.
app/models/ci/bridge.rb
View file @
46b78677
...
...
@@ -62,6 +62,10 @@ module Ci
end
end
def
has_downstream_pipeline?
sourced_pipelines
.
exists?
end
def
downstream_pipeline_params
return
child_params
if
triggers_child_pipeline?
return
cross_project_params
if
downstream_project
.
present?
...
...
app/services/ci/create_cross_project_pipeline_service.rb
View file @
46b78677
...
...
@@ -7,6 +7,7 @@ module Ci
def
execute
(
bridge
)
@bridge
=
bridge
return
if
bridge
.
has_downstream_pipeline?
pipeline_params
=
@bridge
.
downstream_pipeline_params
target_ref
=
pipeline_params
.
dig
(
:target_revision
,
:ref
)
...
...
spec/services/ci/create_cross_project_pipeline_service_spec.rb
View file @
46b78677
...
...
@@ -116,6 +116,22 @@ describe Ci::CreateCrossProjectPipelineService, '#execute' do
expect
(
bridge
.
reload
).
to
be_success
end
context
'when bridge job has already any downstream pipelines'
do
before
do
bridge
.
sourced_pipelines
.
create!
(
source_pipeline:
bridge
.
pipeline
,
source_project:
bridge
.
project
,
project:
bridge
.
project
,
pipeline:
create
(
:ci_pipeline
,
project:
bridge
.
project
)
)
end
it
'does nothing'
do
expect
(
Ci
::
CreatePipelineService
).
not_to
receive
(
:new
)
expect
(
service
.
execute
(
bridge
)).
to
be_nil
end
end
context
'when target ref is not specified'
do
let
(
:trigger
)
do
{
trigger:
{
project:
downstream_project
.
full_path
}
}
...
...
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