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
end
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,
tag: tag?,
trigger: trigger_requests.first)
config_processor.stage_seeds(seeds_scope).tap do |seeds|
seeds.pipeline = self
end
end
def has_stages?
......@@ -312,7 +314,7 @@ module Ci
end
def config_processor
return nil unless ci_yaml_file
return unless ci_yaml_file
return @config_processor if defined?(@config_processor)
@config_processor ||= begin
......
......@@ -202,6 +202,17 @@ describe Ci::Pipeline, models: true do
status: 'success')
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
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