Commit 69626e09 authored by Terri Chu's avatar Terri Chu

Merge branch 'mc/backstage/refactor-build-seed-stage-passing' into 'master'

Pass array of stages to build seed

See merge request gitlab-org/gitlab!73094
parents e3d0d90b bb9a14a3
......@@ -9,7 +9,7 @@ module EE
extend ::Gitlab::Utils::Override
override :attributes
def initialize(context, attributes, previous_stages, current_stage = nil)
def initialize(context, attributes, stages_for_needs_lookup)
super
@dast_configuration = attributes.dig(:options, :dast_configuration)
......
......@@ -11,11 +11,11 @@ module Gitlab
delegate :dig, to: :@seed_attributes
def initialize(context, attributes, previous_stages, current_stage)
def initialize(context, attributes, stages_for_needs_lookup = [])
@context = context
@pipeline = context.pipeline
@seed_attributes = attributes
@stages_for_needs_lookup = (previous_stages + [current_stage]).compact
@stages_for_needs_lookup = stages_for_needs_lookup.compact
@needs_attributes = dig(:needs_attributes)
@resource_group_key = attributes.delete(:resource_group_key)
@job_variables = @seed_attributes.delete(:job_variables)
......
......@@ -17,7 +17,7 @@ module Gitlab
@previous_stages = previous_stages
@builds = attributes.fetch(:builds).map do |attributes|
Seed::Build.new(context, attributes, previous_stages, self)
Seed::Build.new(context, attributes, previous_stages + [self])
end
end
......
......@@ -13,7 +13,7 @@ RSpec.describe Gitlab::Ci::Pipeline::Seed::Build do
let(:previous_stages) { [] }
let(:current_stage) { double(seeds_names: [attributes[:name]]) }
let(:seed_build) { described_class.new(seed_context, attributes, previous_stages, current_stage) }
let(:seed_build) { described_class.new(seed_context, attributes, previous_stages + [current_stage]) }
describe '#attributes' do
subject { seed_build.attributes }
......
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