summaryrefslogtreecommitdiff
path: root/lib/api
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2016-12-19 08:42:52 +0000
committerRémy Coutable <remy@rymai.me>2016-12-19 08:42:52 +0000
commit2c49c1af660a8e69446be442df81f9beaf0cf168 (patch)
treee2ec8f45786eda6a6b101bcbade7f665466f96d9 /lib/api
parent4f77a3f81e71643bc817b6f2b6003e2f322637aa (diff)
parent14d47884dff6844625c2e65b247fd773d78f5ea2 (diff)
downloadgitlab-ce-2c49c1af660a8e69446be442df81f9beaf0cf168.tar.gz
Merge branch 'dockerfile-templates' into 'master'
Allow to use Dockerfile templates See merge request !7247
Diffstat (limited to 'lib/api')
-rw-r--r--lib/api/templates.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/api/templates.rb b/lib/api/templates.rb
index 8a53d9c0095..e23f99256a5 100644
--- a/lib/api/templates.rb
+++ b/lib/api/templates.rb
@@ -8,6 +8,10 @@ module API
gitlab_ci_ymls: {
klass: Gitlab::Template::GitlabCiYmlTemplate,
gitlab_version: 8.9
+ },
+ dockerfiles: {
+ klass: Gitlab::Template::DockerfileTemplate,
+ gitlab_version: 8.15
}
}.freeze
PROJECT_TEMPLATE_REGEX =
@@ -51,7 +55,7 @@ module API
end
params do
optional :popular, type: Boolean, desc: 'If passed, returns only popular licenses'
- end
+ end
get route do
options = {
featured: declared(params).popular.present? ? true : nil
@@ -69,7 +73,7 @@ module API
end
params do
requires :name, type: String, desc: 'The name of the template'
- end
+ end
get route, requirements: { name: /[\w\.-]+/ } do
not_found!('License') unless Licensee::License.find(declared(params).name)
@@ -78,7 +82,7 @@ module API
present template, with: Entities::RepoLicense
end
end
-
+
GLOBAL_TEMPLATE_TYPES.each do |template_type, properties|
klass = properties[:klass]
gitlab_version = properties[:gitlab_version]
@@ -104,7 +108,7 @@ module API
end
params do
requires :name, type: String, desc: 'The name of the template'
- end
+ end
get route do
new_template = klass.find(declared(params).name)