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

sequence.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: dd097187955ca47bdfa0b2089c61da9f9023d6ad (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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# frozen_string_literal: true

module Gitlab
  module Ci
    module Pipeline
      module Chain
        class Sequence
          def initialize(pipeline, command, sequence)
            @pipeline = pipeline
            @command = command
            @sequence = sequence
            @start = current_monotonic_time
          end

          def build!
            @sequence.each do |step_class|
              step_start = current_monotonic_time
              step = step_class.new(@pipeline, @command)

              step.perform!

              @command.observe_step_duration(
                step_class,
                current_monotonic_time - step_start
              )

              break if step.break?
            end

            @command.observe_creation_duration(current_monotonic_time - @start)
            @command.observe_pipeline_size(@pipeline)
            @command.observe_jobs_count_in_alive_pipelines
            @command.observe_pipeline_includes_count(@pipeline)

            @pipeline
          end

          private

          def current_monotonic_time
            ::Gitlab::Metrics::System.monotonic_time
          end
        end
      end
    end
  end
end