Welcome to mirror list, hosted at ThFree Co, Russian Federation.

assign_partition.rb « chain « pipeline « ci « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 0740226ac9b3fbd130b521e9f955567a6ac3a405 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# 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(project)
            end
          end
        end
      end
    end
  end
end