Class: Gitlab::Template::GitlabCiYmlTemplate

Inherits:
BaseTemplate show all
Extended by:
Utils::Override, Utils::StrongMemoize
Defined in:
lib/gitlab/template/gitlab_ci_yml_template.rb

Constant Summary collapse

BASE_EXCLUDED_PATTERNS =
[%r{\.latest\.}].freeze
BASE_DIR =
'lib/gitlab/ci/templates'

Instance Attribute Summary

Attributes inherited from BaseTemplate

#category

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Utils::Override

extended, extensions, included, method_added, override, prepended, queue_verification, verify!

Methods inherited from BaseTemplate

#<=>, all, by_category, category_directory, #content, find, #full_name, #initialize, #name, #project_id, repository_template_names, #resolve!, template_names_by_category, template_subsets, #to_json

Constructor Details

This class inherits a constructor from Gitlab::Template::BaseTemplate

Class Method Details

.additional_excluded_patternsObject



42
43
44
# File 'lib/gitlab/template/gitlab_ci_yml_template.rb', line 42

def additional_excluded_patterns
  [%r{Verify/Browser-Performance}]
end

.base_dirObject



46
47
48
# File 'lib/gitlab/template/gitlab_ci_yml_template.rb', line 46

def base_dir
  Rails.root.join(BASE_DIR)
end

.categoriesObject



21
22
23
24
25
26
27
28
# File 'lib/gitlab/template/gitlab_ci_yml_template.rb', line 21

def categories
  {
    'General' => '',
    'Pages' => 'Pages',
    'Verify' => 'Verify',
    'Auto deploy' => 'autodeploy'
  }
end

.excluded_patternsObject



36
37
38
39
40
# File 'lib/gitlab/template/gitlab_ci_yml_template.rb', line 36

def excluded_patterns
  strong_memoize(:excluded_patterns) do
    BASE_EXCLUDED_PATTERNS + additional_excluded_patterns
  end
end

.extensionObject



17
18
19
# File 'lib/gitlab/template/gitlab_ci_yml_template.rb', line 17

def extension
  '.gitlab-ci.yml'
end

.finder(project = nil) ⇒ Object



50
51
52
53
54
55
56
57
58
# File 'lib/gitlab/template/gitlab_ci_yml_template.rb', line 50

def finder(project = nil)
  Gitlab::Template::Finders::GlobalTemplateFinder.new(
    self.base_dir,
    self.extension,
    self.categories,
    self.include_categories_for_file,
    excluded_patterns: self.excluded_patterns
  )
end

.include_categories_for_fileObject



30
31
32
33
34
# File 'lib/gitlab/template/gitlab_ci_yml_template.rb', line 30

def include_categories_for_file
  {
    "SAST#{self.extension}" => { 'Security' => 'Security' }
  }
end

Instance Method Details

#descriptionObject



9
10
11
# File 'lib/gitlab/template/gitlab_ci_yml_template.rb', line 9

def description
  "# This file is a template, and might need editing before it works on your project."
end