debian-mirror-gitlab/lib/gitlab/ci/pipeline/chain/ensure_resource_groups.rb
2022-01-26 12:08:38 +05:30

34 lines
851 B
Ruby

# frozen_string_literal: true
module Gitlab
module Ci
module Pipeline
module Chain
class EnsureResourceGroups < Chain::Base
def perform!
return unless pipeline.create_deployment_in_separate_transaction?
pipeline.stages.map(&:statuses).flatten.each(&method(:ensure_resource_group))
end
def break?
false
end
private
def ensure_resource_group(processable)
return unless processable.is_a?(::Ci::Processable)
key = processable.options.delete(:resource_group_key)
resource_group = ::Gitlab::Ci::Pipeline::Seed::Processable::ResourceGroup
.new(processable, key).to_resource
processable.resource_group = resource_group
end
end
end
end
end
end