Add an option to skip_ci to the Releases API
Problem to solve
The release
node of the .gitlab-ci.yml
file can be used to trigger automated release creation. This node uses the release-cli to talk to the Releases API. There are at least two possible scenarios to create a release:
-
Create a release when a git tag is manually created and pushed
release-from-tag: rules: - if: $CI_COMMIT_TAG release: tag_name: $CI_COMMIT_TAG
-
Create a release and generate a git tag automatically, for example, when pushing to the
$CI_DEFAULT_BRANCH
script: # generate the tag somehow - export TAG=v"$(cat VERSION)" # or e.g. using semantic-versioning to generate the next tag auto-release: stage: release rules: - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH - if: $CI_COMMIT_TAG # do not run on tags when: never release: tag_name: $TAG ref: $CI_COMMIT_SHA
The complete examples can be found in the docs
However, it's not possible to have both configurations together in a single .gitlab-ci.yml
CI config file without triggering an extra pipeline from the second scenario (see !35583 (comment 371370996))
Intended users
User experience goal
The user should be able to have multiple release
configurations in the .gitlab-ci.yml
file to automate release creation without creating conflicts between them.
Proposal
-
Add a new field to the Releases API create release to skip_ci
when creating a release and send it when tagging and pushing -
Add the skip_ci
field to therelease
node of the CI configuration file. -
Add the --skip-ci
flag to therelease-cli
This option will give more flexibility and control to the users when creating a release via the CI file. It will also help us prevent triggering unnecessary pipelines that may fail.
Further details
Related conversations: