Commit 5c2ce44b authored by Grzegorz Bizon's avatar Grzegorz Bizon

Expose pipeline stage seeds from pipeline instance

parent c72e21fd
...@@ -296,11 +296,13 @@ module Ci ...@@ -296,11 +296,13 @@ module Ci
end end
def stage_seeds def stage_seeds
return [] unless config_processor return unless config_processor
seeds_scope = { ref: ref, tag: tag?, trigger: trigger_requests.first }
config_processor.stage_seeds(ref: ref, config_processor.stage_seeds(seeds_scope).tap do |seeds|
tag: tag?, seeds.pipeline = self
trigger: trigger_requests.first) end
end end
def has_stages? def has_stages?
...@@ -312,7 +314,7 @@ module Ci ...@@ -312,7 +314,7 @@ module Ci
end end
def config_processor def config_processor
return nil unless ci_yaml_file return unless ci_yaml_file
return @config_processor if defined?(@config_processor) return @config_processor if defined?(@config_processor)
@config_processor ||= begin @config_processor ||= begin
......
...@@ -202,6 +202,17 @@ describe Ci::Pipeline, models: true do ...@@ -202,6 +202,17 @@ describe Ci::Pipeline, models: true do
status: 'success') status: 'success')
end end
describe '#stage_seeds' do
let(:pipeline) do
create(:ci_pipeline, config: { rspec: { script: 'rake' } })
end
it 'returns preseeded stage seeds object' do
expect(pipeline.stage_seeds).to be_a Gitlab::Ci::Stage::Seeds
expect(pipeline.stage_seeds.stages).to all(include(pipeline: pipeline))
end
end
describe '#stages' do describe '#stages' do
subject { pipeline.stages } subject { pipeline.stages }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment