debian-mirror-gitlab/lib/gitlab/ci/pipeline/chain/assign_partition.rb
2022-10-11 01:57:18 +05:30

31 lines
628 B
Ruby

# frozen_string_literal: true
module Gitlab
module Ci
module Pipeline
module Chain
class AssignPartition < Chain::Base
include Chain::Helpers
def perform!
@pipeline.partition_id = find_partition_id
end
def break?
@pipeline.errors.any?
end
private
def find_partition_id
if @command.creates_child_pipeline?
@command.parent_pipeline_partition_id
else
::Ci::Pipeline.current_partition_value
end
end
end
end
end
end
end