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