Instance template repository (PREMIUM SELF)

In hosted systems, enterprises often have a need to share their own templates across teams. This feature allows an administrator to pick a project to be the instance-wide collection of file templates. These templates are then exposed to all users via the web editor while the project remains secure.

Configuration

As an administrator, navigate to Admin Area > Settings > Templates and select the project to serve as the custom template repository.

File templates in the Admin Area

After that, you can add custom templates to the selected repository and use them for the entire instance. They are available in the Web Editor's dropdown and through the API settings.

Templates must be added to a specific subdirectory in the repository, corresponding to the kind of template. The following types of custom templates are supported:

Type Directory Extension
Dockerfile Dockerfile .dockerfile
.gitignore gitignore .gitignore
.gitlab-ci.yml gitlab-ci .yml
LICENSE LICENSE .txt
metrics-dashboard.yml metrics-dashboards .yml

Each template must go in its respective subdirectory, have the correct extension and not be empty. So, the hierarchy should look like this:

|-- README.md
|-- Dockerfile
    |-- custom_dockerfile.dockerfile
    |-- another_dockerfile.dockerfile
|-- gitignore
    |-- custom_gitignore.gitignore
    |-- another_gitignore.gitignore
|-- gitlab-ci
    |-- custom_gitlab-ci.yml
    |-- another_gitlab-ci.yml
|-- LICENSE
    |-- custom_license.txt
    |-- another_license.txt
|-- metrics-dashboards
    |-- custom_metrics-dashboard.yml
    |-- another_metrics-dashboard.yml

Your custom templates are displayed on the dropdown menu when a new file is added through the GitLab UI:

Custom template dropdown menu

If this feature is disabled or no templates are present, no Custom section displays in the selection dropdown.