Instance template repository
- Tier: Premium, Ultimate
- Offering: GitLab Self-Managed
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 through the Web Editor while the project remains secure.
Configuration
To select a project to serve as the custom template repository:
- On the left sidebar, at the bottom, select Admin.
- Select Settings > Templates.
- Expand Templates
- From the dropdown list, select the project to use as the template repository.
- Select Save changes.
- Add custom templates to the selected repository.
After you add templates, you can use them for the entire instance. They are available in the Web Editor and through the API settings.
These templates cannot be used as a value of the
include:template
key in .gitlab-ci.yml
.
Supported file types and locations
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 |
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
Your custom templates are displayed on the dropdown list when a new file is added through the GitLab UI:
If this feature is disabled or no templates are present, no Custom section displays in the selection dropdown list.
Docs
Edit this page to fix an error or add an improvement in a merge request.
Create an issue to suggest an improvement to this page.
Product
Create an issue if there's something you don't like about this feature.
Propose functionality by submitting a feature request.
Feature availability and product trials
View pricing to see all GitLab tiers and features, or to upgrade.
Try GitLab for free with access to all features for 30 days.
Get help
If you didn't find what you were looking for, search the docs.
If you want help with something specific and could use community support, post on the GitLab forum.
For problems setting up or using this feature (depending on your GitLab subscription).
Request support