Allow global, user-defined override of CI templates location referenced via include:template
Problem to solve
In %11.7 the include:template feature was introduced (#53445 (closed)). include:template enables users to easily reference a set of blessed .gitlab-ci.yml templates that ship with gitlab.
Currently, the location of these blessed templates is not configurable and users can only select from those shipped with GitLab itself.
We should make the location of these templates configurable the same way that the instance template repository is configurable.
Target audience
- Sasha, Software Developer, https://design.gitlab.com/research/personas#persona-sasha
- Devon, DevOps Engineer, https://design.gitlab.com/research/personas#persona-devon
- Sam, Security Analyst, https://design.gitlab.com/research/personas#persona-sam
Proposal
Add a new configuration section to /admin/application_settings/templates that enables selecting a local Project + optional subdirectory path.
When set, the value of [group/]<project>[/subdirectory/path/] is used to set the location of CI templates that may be referenced using the include:template property.
example
Configuration options of:
group = templatesproject = ci-templates-
subdirectory = /(default)
Contents of templates/ci-templates repository:
.
└── Nodejs-library.gitlab-ci.yml
## Nodejs-library.gitlab-ci.yml
.node10:
image: node:dubnium
before_script: node -p process.version
Contents of my-libraries/library repository:
.
└── .gitlab-ci.yml
## .gitlab-ci.yml
include:
- template: Nodejs-library.gitlab-ci.yml
job:
extends: .node10
script: node -p '"hello world"'