Implement `include:component` syntax
With the new decisions added to the blueprint about the directory structure we have all the pieces to start working on an MVC for components.
Problem to solve
As a user I want to create components in a project following the directory structure and guidelines in the blueprint. Then I want to consume these components in my .gitlab-ci.yml.
Details
In this phase it's not required for components to be published to a Catalog. It's sufficient for the user to know the full path of the component to use.
Proposal
Introduce include:component syntax that behaves similarly like other include types. It will automatically support with: inputs once they are available.
include:
- component: org/my-project@main
- component: org/my-project/my-component@main
- For
org/my-project@mainwe fetch the filetemplate.ymlin the root directory for the HEAD SHA ofmainbranch. - For
org/my-project/my-component@mainwe fetch the filetemplate.ymlinmy-componentdirectory for the HEAD SHA ofmainbranch.
Version qualifiers to support are:
@<sha>@<tag_name>@<branch_name>
These qualifiers are ordered by precedence based on the decision in the blueprint.
Before merging the resulting YAML from a component we should check that the YAML, which is going to be merged with the main .gitlab-ci.yml, does not contain any of the following top-level keywords: default, variables, stages. These keywords are anti-patterns in the design of components because they would leak settings to other jobs in the pipeline.
Change should be made behind a feature flag.