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
09b4e494
Commit
09b4e494
authored
Jan 25, 2019
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support passing bridge variables to downstream pipeline
parent
dcaaacb0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
1 deletion
+26
-1
ee/app/models/ee/ci/bridge.rb
ee/app/models/ee/ci/bridge.rb
+9
-1
ee/app/services/ci/create_cross_project_pipeline_service.rb
ee/app/services/ci/create_cross_project_pipeline_service.rb
+4
-0
ee/spec/services/ci/create_cross_project_pipeline_service_spec.rb
...services/ci/create_cross_project_pipeline_service_spec.rb
+13
-0
No files found.
ee/app/models/ee/ci/bridge.rb
View file @
09b4e494
...
...
@@ -6,7 +6,11 @@ module EE
extend
ActiveSupport
::
Concern
prepended
do
serialize
:options
# rubocop:disable Cop/ActiveRecordSerialize
# rubocop:disable Cop/ActiveRecordSerialize
serialize
:options
serialize
:yaml_variables
,
::
Gitlab
::
Serializer
::
Ci
::
Variables
# rubocop:enable Cop/ActiveRecordSerialize
has_many
:sourced_pipelines
,
class_name:
::
Ci
::
Sources
::
Pipeline
,
foreign_key: :source_job_id
...
...
@@ -34,6 +38,10 @@ module EE
def
target_ref
options
&
.
dig
(
:trigger
,
:branch
)
end
def
downstream_variables
yaml_variables
.
map
{
|
hash
|
hash
.
except
(
:public
)
}
end
end
end
end
ee/app/services/ci/create_cross_project_pipeline_service.rb
View file @
09b4e494
...
...
@@ -43,6 +43,10 @@ module Ci
source_project:
@bridge
.
project
,
project:
target_project
,
pipeline:
pipeline
)
# TODO we should use metadata with bridge jobs too.
#
pipeline
.
variables
.
build
(
@bridge
.
downstream_variables
)
end
end
...
...
ee/spec/services/ci/create_cross_project_pipeline_service_spec.rb
View file @
09b4e494
...
...
@@ -141,5 +141,18 @@ describe Ci::CreateCrossProjectPipelineService, '#execute' do
expect
(
bridge
.
failure_reason
).
to
eq
'invalid_bridge_trigger'
end
end
context
'when bridge job has YAML variables defined'
do
before
do
bridge
.
yaml_variables
=
[{
key:
'BRIDGE'
,
value:
'var'
,
public:
true
}]
end
it
'passes bridge variables to downstream pipeline'
do
pipeline
=
service
.
execute
(
bridge
)
expect
(
pipeline
.
variables
.
first
)
.
to
have_attributes
(
key:
'BRIDGE'
,
value
:'var'
)
end
end
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