@@ -9,13 +9,13 @@ This page presents the general principles of use supported throughout all _to be
## Include a template
As previously said, each template may be [included](https://docs.gitlab.com/ci/yaml/#include) in your `.gitlab-ci.yml` file using one of the 3 techniques:
As previously said, each template may be [included](https://docs.gitlab.com/ci/yaml/#include) in your `.gitlab-ci.yml` file using one of the 3 following syntaxes:
*[`include:component`](https://docs.gitlab.com/ci/yaml/#includecomponent) to use it as a [CI/CD component](https://docs.gitlab.com/ci/components/),
*[`include:project`](https://docs.gitlab.com/ci/yaml/#includeproject) to use it as a regular template,
* or [`include:remote`](https://docs.gitlab.com/ci/yaml/#includeremote)(this technique might be interesting if you want to test _to be continuous_ from your Self-Managed GitLab without installing it locally).
=== "#1: `include:component`"
For example (CI/CD component):
The [`include:component`](https://docs.gitlab.com/ci/yaml/#includecomponent) is the newest
GitLab syntax and allows to use templates as a [CI/CD component](https://docs.gitlab.com/ci/components/)
(thus configuring them with [`inputs`](https://docs.gitlab.com/ci/inputs/)):
The [`include:project`](https://docs.gitlab.com/ci/yaml/#includeproject) syntax is the former GitLab syntax, and is very similar (except it implies configuring templates with [`variables`](https://docs.gitlab.com/ci/variables/)):
```yaml
include:
# Maven template with exact version '3.9.0'
- project: "to-be-continuous/maven"
ref: "3.9.0"
file: "templates/gitlab-ci-maven.yml"
# AWS template with minor version alias '5.2' (uses the latest available patch version)
- project: "to-be-continuous/aws"
ref: "5.2"
file: "templates/gitlab-ci-aws.yml"
```
=== "#3: `include:remote`"
The [`include:remote`](https://docs.gitlab.com/ci/yaml/#includeremote) syntax might be interesting if you want to test _to be continuous_ from your Self-Managed GitLab without installing it locally (thus you'll be able to download _to be continuous_ templates directly from [gitlab.com](https://gitlab.com/to-be-continuous)).
With this syntax, templates have to be configured with [variables](https://docs.gitlab.com/ci/variables/).
Our templates are **versioned** (compliant with [Semantic Versioning](https://semver.org/)):
* each version is exposed through a Git tag such as `1.1.0`, `2.1.4`, ...
@@ -128,7 +158,7 @@ In some cases, using the latest version is a good thing, and in some other cases
* _latest_ is **not good** for:
* Build tools as your project is developped using one specific version of the language / the build tool, and you would like to control when you change version.
* Infrastructure-as-Code tools for the same reason as above.
* Acceptance tests tools as the same reason as build tools.
* Acceptance tests tools for the same reason as build tools.
* Private cloud CLI clients as you may not have installed the latest version of - say - OpenShift or Kubernetes, and you'll need to use the client CLI version that matches your servers version.
> [!tip] To summarize
@@ -490,7 +520,7 @@ You might also want to globally override the test & analysis and/or the acceptan
- when: on_success
```
## Advanced usage - Override YAML
## Override YAML (Advanced Usage)
Sometimes, configuration via variables is not enough to tweak an existing template to fit to your needs.
It may happen that you need to multi-instantiate a _to-be-continuous_ template in your project.
A very common case is with monorepos, when your Git repository hosts multiple independant projects.
Most of _to-be-continuous_ templates support GitLab's [`parallel:matrix` syntax](https://docs.gitlab.com/ci/yaml/#parallelmatrix) to allow multiple template instantiation.
All you have to do is to define a `parallel:matrix` configuration at the [template's base job](#the-templates-base-job) level in your `.gitlab-ci.yml` file,
and define each project specific configuration in your matrix entries.
Example (multi instanciation of the Python template):