Include inputs cannot be used together with include rules
Summary
It is impossible to use input variables of include in include rules. Since include inputs are resolved to strings, if conditions relying on those are deemed syntactically invalid because if condition of a rule must contain at least one variable on either side.
Steps to reproduce
See example project.
Example Project
.gitlab-ci.yml:
include:
- local: '/included.yml'
inputs:
foo: bar
included.yml:
spec:
inputs:
foo:
type: string
---
include:
- local: '/conditional.yml'
rules:
- if: $[[ inputs.foo ]] == "bar"
conditional.yml:
Test:
image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/alpine
stage: build
rules:
when: always
script:
- echo Hello World
What is the current bug behavior?
The pipeline fails to create because of invalid if rule condition in included.yml.
What is the expected correct behavior?
The include rule in included.yml should be evaluated correctly.
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
Seems like a really trivial fix, just to allow both sides of if condition to contain plain strings.