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