Add metadata to GitLab Managed CI/CD Templates [RUN ALL RSPEC] [RUN AS-IF-FOSS]
What does this MR do?
This MR adds metadata to GitLab Managed CI/CD Templates with partially supporting template_metadata
keyword in .gitlab-ci.yml. This gives us a better maintainability such as:
- What DevOps stage is involved in the template.
- What feature category is involved in the template.
- Which R&D group is responsible to maintain the template.
- How to use the template.
These information will be visualized in the upcoming UX issue.
This template_metadata
keyword does not affect pipelines/jobs generation mechanizm at all. It's just a metadata container, so it's safe to be used.
template_metadata
keyword
Details of the You must define the template metadata in a GitLab managed CI/CD template.
For fabricating the template information, we extended the capability of the CI/CD templates
to have a structured metadata
that can be populated on UI/API.
Specifically, we've introduced template_metadata
keyword to .gitlab-ci.yml
that consists of the following attributes:
Attribute | Description | Required |
---|---|---|
name |
The name of the template. | Yes |
desc |
The description of the template. | Yes |
stages |
The GitLab DevOps Stages that the template is involved. | Yes |
categories |
The GitLab Feature Categories that the template is involved. | Yes |
maintainers |
The GitLab Groups which are responsible to maintain the template. | Yes |
usage |
How to use the template. See below for more details. | Yes |
inclusion_type |
How to use the template when usage is inclusion . See below for more details. |
Yes |
The details of usage
attributes:
Value | Workflow management | Description |
---|---|---|
copy-paste |
Decentralized | The template is copy-pasted into a project workflow file and maintained/versioned in each repository. This is the tradional behavior of GitLab templates that provide a starter content to be a new instance, like Issue/MR templates. |
inclusion |
Centralized | The template is include d into a project workflow file and maintained/versioned in the GitLab canonical repository. This is the unique concept in GitLab CI/CD that directly consumes a template. |
The details of inclusion_type
attributes:
Value | Jobs defined? | Global keyword exists? | YAML anchors only? | Description |
---|---|---|---|---|
shared-workflow |
Yes | Yes/No | No | The end-to-end CI/CD workflow to be shared with the other projects. |
workflow-extension |
No | Yes | No | The extension of the workflow-level configs (i.e. global keywords) to be shared with the other projects. |
composable-job |
No | No | Yes | The YAML anchors to be included into the project workflow for composing a job with extends or !reference . |
other |
Yes/No | Yes/No | Yes/No |
NOTE: YAML anchors is a hidden configuration to be used with extends
.
Related #334663 #335279 (closed)
Important notes
template_metadata
keyword will be allowed for users/organizations in the future (At this moment, we're experimenting this feature in GitLab managed templates only). For example, most of the attributes are optional for end-users, and we don't change this concept for GitLab managed templates. So that we're enforcing the GitLab specific practice in our daily testing pipelines (rspec
).
Does this MR meet the acceptance criteria?
Conformity
-
I have included changelog trailers, or none are needed. (Does this MR need a changelog?) -
I have added/updated documentation, or it's not needed. (Is documentation required?) -
I have properly separated EE content from FOSS, or this MR is FOSS only. (Where should EE code go?) -
I have added information for database reviewers in the MR description, or it's not needed. (Does this MR have database related changes?) -
I have self-reviewed this MR per code review guidelines. -
This MR does not harm performance, or I have asked a reviewer to help assess the performance impact. (Merge request performance guidelines) -
I have followed the style guides. -
This change is backwards compatible across updates, or this does not apply.
Availability and Testing
-
I have added/updated tests following the Testing Guide, or it's not needed. (Consider all test levels. See the Test Planning Process.) -
I have tested this MR in all supported browsers, or it's not needed. -
I have informed the Infrastructure department of a default or new setting change per definition of done, or it's not needed.
Security
Does this MR contain changes to processing or storing of credentials or tokens, authorization and authentication methods or other items described in the security review guidelines? If not, then delete this Security section.
-
Label as security and @ mention @gitlab-com/gl-security/appsec
-
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team