GitLab CI/CD Component and partial version/semver on include

,

One missing option in CI/CD components | GitLab is the ability for a consuming .gitlab-ci.yml file to specify only part of the semantic version of a component. For example, if the component has version 1.0.0, it should be safe for consumers to depend on the major version 1 for all minor/patch updates to a component. However, if the component has a major revision (i.e. breaking changes), then the version should move to 2.0.0, and the consumer dependent on 1 should still be safe.

Right now, you only have the option to use ~latest, which is generally unsafe, or the full semantic version, which does not allow for what should be “non-breaking” updates “for free”. You can use branch names, which is similar to ~latest (unless you have major-version specific branches, which isn’t awesome either), and also a commit SHA, which is essentially more-locked-in than using the full semver.

Note that I’ve tried this on a component with version 1.0.0:

include:
  - component: gitlab.com/group1/project1/component1@1

but you get this error:

This GitLab CI configuration is invalid: component ‘gitlab.com/group1/project1/component1@1’ - content not found.

1 Like