Expose pipeline stage seeds from pipeline instance
This commit is contained in:
parent
c72e21fd97
commit
5c2ce44baf
2 changed files with 18 additions and 5 deletions
|
@ -296,11 +296,13 @@ module Ci
|
|||
end
|
||||
|
||||
def stage_seeds
|
||||
return [] unless config_processor
|
||||
return unless config_processor
|
||||
|
||||
config_processor.stage_seeds(ref: ref,
|
||||
tag: tag?,
|
||||
trigger: trigger_requests.first)
|
||||
seeds_scope = { 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 }
|
||||
|
||||
|
|
Loading…
Reference in a new issue