Pattern Matching with Variables Causes GitLabs CI Lint to Throw 500
Summary
Pattern Matching in .gitlab-ci.yml
file with Variables Causes GitLabs CI Lint to throw 500.
Also, pipelines fail with invalid yaml error.
Steps to reproduce
See this documentation: https://docs.gitlab.com/ee/ci/variables/#supported-syntax
According to documentation this logic works:
$VARIABLE_1 == $VARIABLE_2
and this works as well:
$VARIABLE =~ /^content.*/
But if you use use a combination of the two like $VARIABLE_1 =~ $VARIABLE_2
it causes errors and pipeline failures.
Example Project
This works:
---
variables:
DEVELOP_BRANCH_REGEX: /^develop/
stages:
- test
test:good:
stage: test
only:
refs:
- branches
variables:
- $CI_COMMIT_REF_NAME =~ "/^develop/"
script:
- 'echo $CI_COMMIT_REF_NAME'
But DOES NOT work:
---
variables:
DEVELOP_BRANCH_REGEX: /^develop/
stages:
- test
test:exception:
stage: test
only:
refs:
- branches
variables:
- $CI_COMMIT_REF_NAME =~ $DEVELOP_BRANCH_REGEX
script:
- 'echo $CI_COMMIT_REF_NAME'
What is the current bug behavior?
GitLabs CI Lint page throws 500 error.
Pipelines fail with invalid yaml error.
What is the expected correct behavior?
Pattern matching with two variables to work correctly.