Skip to content

Add `include:component` syntax to fetch CI components

Fabio Pitino requested to merge ci-include-component-syntax into master

What does this MR do and why?

Related to Implement `include:component` syntax (#387178 - closed)

This MR introduces the syntax include:component that fetches component template.yml file from a specified location. It supports FQDN, meaning that only components located in the same GitLab instance are initially permitted.

Examples

include:
  - component: gitlab.com/org/components-project@main # branch name
  - component: gitlab.com/org/components-project@1.0  # tag name
  - component: gitlab.com/org/components-project@c8b0239a6c5702c3253adf9da97c1b94097913e0
  - component: gitlab.com/org/components-project/my-component@1.0 # combination of the above versions + direct path to component dir
  - component: path/to/local/component/dir

Not included to this MVC are the version qualifier:

  • @1.0 as the release name - scoped out until we refine the release of new components version.
  • @~latest as the latest available release name - scoped out as the above.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

How to set up and validate locally

  1. Create a new project (e.g. root/test-component) that will be containing a default component in the root directory.
  2. Create a file template.yml in the root directory of the new project and add.
component-a:
  script: echo
component-b:
  script: echo
  1. Create a directory and file another-component/template.yml where we will create a specific component.
another-component-job:
  script: echo
  1. Create or reuse another project to use the components just created. Edit the .gitlab-ci.yml:
include:
  - component: 'gdk.test/root/test-component@main' # load default top-level component
  - component: 'gdk.test/root/test-component/another-component@main' # load specific component
job:
  script: echo
  1. Commit the changes. You should have a pipeline including all jobs:

image

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Fabio Pitino

Merge request reports

Loading