Variable Expressions not correctly evaluated when using Windows variable syntax
Summary
When using only
in a job with variables
the Windows variable syntax (e.g. $env:VAR
or %VAR%
) seems not to be evaluated correctly. The CI Lint always throws an error (actually two different errors depending on the syntax).
The errors are either:
- Error: jobs:JOB_NAME:only variables invalid expression syntax
- Error: (): did not find expected '-' indicator while parsing a block collection at line LINE column COLUMN
If I am doing something wrong here, I simply can't figure it out.
EDIT: Contrary to the documentation on variables on different systems, the Linux variable syntax seems to work perfectly even on a Windows runner.
Steps to reproduce
Fail in CI LINT
Error: (): did not find expected '-' indicator while parsing a block collection at line 9 column 7
stages:
- build
build_job:
stage: build
only:
refs:
- pipelines
variables:
- "release" == %CI_COMMIT_REF_SLUG%
script:
- echo something
Error: jobs:build_job:only variables invalid expression syntax
stages:
- build
build_job:
stage: build
only:
refs:
- pipelines
variables:
- '"release" == %CI_COMMIT_REF_SLUG%'
script:
- echo something
It does not matter what comes first here, the variable or the string and switching quotes (double single) neither
Working in CI LINT
stages:
- build
build_job:
stage: build
only:
refs:
- pipelines
variables:
- $CI_COMMIT_REF_SLUG == "release"
script:
- echo something
What is the current bug behavior?
CI Lint throws an error on out local EE Instance as well as on gitlab.com
What is the expected correct behavior?
Should be considered correct
Relevant logs and/or screenshots
Edited by Konstantin Wolff