Backend: Pipeline editor does not resolves ${CI_COMMIT_REF_NAME} on include
Summary
The pipeline editor complains about : "This GitLab CI configuration is invalid: Project `my-template-repo` reference `` does not exist!" when including a template from a project and a branch set with ${CI_COMMIT_REF_NAME}
Steps to reproduce
Insert into a gitlab-ci.yml
include:
- project: 'pokexpert30/simple-template'
ref: ${CI_COMMIT_REF_NAME}
file: 'simple-template.gitlab-ci.yml'
And watch the pipeline editor freaks out.
Everything still works doe : https://gitlab.com/pokexpert30/simple-template-user/-/pipelines/1196975753
$ echo I am running a variable $hello
I am running a variable foo
Gitlab.com example projects :
https://gitlab.com/pokexpert30/simple-template # contains the normal gitlab.com ci template + a variable
https://gitlab.com/pokexpert30/simple-template-user # uses the said template
What is the current bug behavior?
Not only this removes the syntax checker from the pipeline editor, it also removes the pre-set variables from displaying when starting a manual pipeline. Please note that the pipeline executes correctly.
What is the expected correct behavior?
You should not get an error if the target branch exists. Also variables should be displayed on starting manual pipeline.
Possible fixes
A possible fix may be to initialize a pipeline with ref in lib/gitlab/ci/lint.rb
and pass it into Gitlab::Ci::YamlProcessor
. Or, maybe, we should do this in lib/gitlab/ci/config.rb
when initializing a pipeline.
Additional details
Some relevant technical details, if applicable, such as:
- Does this need a feature flag? Yes because it's a risky area to change something.
- Does there need to be an associated instrumentation issue created related to this work?
- Is there an example response showing the data structure that should be returned (new endpoints only)?
- What permissions should be used?
- Is this EE or CE?
-
EE -
CE
-
- Additional comments: