debian-mirror-gitlab/lib/gitlab/ci/pipeline/chain/assign_partition.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

32 lines
628 B
Ruby
Raw Normal View History

2022-10-11 01:57:18 +05:30
# 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