Release yaml node :ref should allow branches or tags
Summary
The release yaml node ref
should allow using branches or existing tags.
Per the Releases API documentation
It can be a commit SHA, another tag name, or a branch name.
With !34943 (merged) the ref
is validated via Commit.reference_valid?
. This validation fails for branches or tags.
Steps to reproduce
Requires Feature.enable!(:ci_release_generation)
Use a branch name as reference as ref in the release yaml configuration
release:
ref: 'master'
The pipeline will return an error because red is not a valid reference
'release ref must be a valid ref'
Example Project
For this .gitlab-ci.yml file with pipeline https://dev.gitlab.org/jaime/hello/-/pipelines/160659
What is the current bug behavior?
When using a non-commit SHA as ref the pipeline does not run
'release ref must be a valid ref'
What is the expected correct behavior?
The pipeline should run if the ref is a commit SHA, a tag or a branch name
Relevant logs and/or screenshots
Output of checks
Results of GitLab environment info
Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of: `sudo gitlab-rake gitlab:env:info`) (For installations from source run and paste the output of: `sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)
Results of GitLab application Check
Expand for output related to the GitLab application check
(For installations with omnibus-gitlab package run and paste the output of:
sudo gitlab-rake gitlab:check SANITIZE=true
)(For installations from source run and paste the output of:
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true
)(we will only investigate if the tests are passing)
Possible fixes
Remove this validation Commit.reference_valid?
and let the API decide wether the release can be created from the ref or not.