2019-02-15 15:39:39 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-06-22 15:30:34 +05:30
|
|
|
module Gitlab
|
|
|
|
module Template
|
2016-09-13 17:45:13 +05:30
|
|
|
class GitlabCiYmlTemplate < BaseTemplate
|
2016-06-22 15:30:34 +05:30
|
|
|
def content
|
|
|
|
explanation = "# This file is a template, and might need editing before it works on your project."
|
|
|
|
[explanation, super].join("\n")
|
|
|
|
end
|
|
|
|
|
|
|
|
class << self
|
|
|
|
def extension
|
|
|
|
'.gitlab-ci.yml'
|
|
|
|
end
|
|
|
|
|
|
|
|
def categories
|
|
|
|
{
|
2017-08-17 22:00:37 +05:30
|
|
|
'General' => '',
|
|
|
|
'Pages' => 'Pages',
|
2020-04-08 14:13:33 +05:30
|
|
|
'Verify' => 'Verify',
|
2017-08-17 22:00:37 +05:30
|
|
|
'Auto deploy' => 'autodeploy'
|
2016-06-22 15:30:34 +05:30
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2020-04-08 14:13:33 +05:30
|
|
|
def disabled_templates
|
|
|
|
%w[
|
|
|
|
Verify/Browser-Performance
|
|
|
|
]
|
|
|
|
end
|
|
|
|
|
2016-06-22 15:30:34 +05:30
|
|
|
def base_dir
|
2018-12-05 23:21:45 +05:30
|
|
|
Rails.root.join('lib/gitlab/ci/templates')
|
2016-06-22 15:30:34 +05:30
|
|
|
end
|
2016-09-13 17:45:13 +05:30
|
|
|
|
|
|
|
def finder(project = nil)
|
2020-04-08 14:13:33 +05:30
|
|
|
Gitlab::Template::Finders::GlobalTemplateFinder.new(
|
|
|
|
self.base_dir, self.extension, self.categories, exclusions: self.disabled_templates
|
|
|
|
)
|
2016-09-13 17:45:13 +05:30
|
|
|
end
|
2016-06-22 15:30:34 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2019-12-04 20:38:33 +05:30
|
|
|
|
|
|
|
Gitlab::Template::GitlabCiYmlTemplate.prepend_if_ee('::EE::Gitlab::Template::GitlabCiYmlTemplate')
|