Skip to content

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

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 = templates
  • project = 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"'

Links / references

Edited by Kyle Smith