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

template_usage.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: 2fcf1740b5f100395a789b46e5eca8b28a047313 (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
# frozen_string_literal: true

module Gitlab
  module Ci
    module Pipeline
      module Chain
        class TemplateUsage < Chain::Base
          def perform!
            included_templates.each do |template|
              track_event(template)
            end
          end

          def break?
            false
          end

          private

          def track_event(template)
            Gitlab::UsageDataCounters::CiTemplateUniqueCounter
              .track_unique_project_event(project_id: pipeline.project_id, template: template, config_source: pipeline.config_source)
          end

          def included_templates
            command.yaml_processor_result.included_templates
          end
        end
      end
    end
  end
end