2021-03-08 18:12:59 +05:30
|
|
|
# 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
|
2021-03-11 19:13:27 +05:30
|
|
|
.track_unique_project_event(project_id: pipeline.project_id, template: template, config_source: pipeline.config_source)
|
2021-03-08 18:12:59 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
def included_templates
|
|
|
|
command.yaml_processor_result.included_templates
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|