Bug in rule interpretation
firecow opened this issue · comments
Minimal .gitlab-ci.yml illustrating the issue
rules:
- { if: $GITLAB_CI == 'false' && $APP_ENV_TIER =~ 'dev', when: manual, allow_failure: true }
- { if: $GITLAB_CI == 'true' && $APP_ENV_TIER =~ 'stage', when: manual, allow_failure: true }
- { if: $GITLAB_CI == 'true' && $APP_ENV_TIER =~ 'prod' && $CI_COMMIT_TAG != null, when: manual, allow_failure: true }
- { when: never }
Expected behavior
I expect these rules to produce no errors
Host information
Ubuntu
gitlab-ci-local 4.52.1 works, gitlab-ci-local 4.53.0 does not,
Containerd binary
docker
Additional context
mjn@mjn-laptop:~/$ gitlab-ci-local --list --variable GITLAB_CI=false
Error attempting to evaluate the following rules:
rules:
- if: '"false" == 'false' && "dev" =~ 'dev''
as
```javascript
"false" == 'false' && "dev" =~ 'dev'
\```
By the way, rhs of ~= should be regex
provided snippet is not recommended as per https://docs.gitlab.com/ee/ci/jobs/job_rules.html#unexpected-behavior-from-regular-expression-matching-with-
nevertheless gcl shouldnt crash
opps.. seemed like i have missed out on the single quotes here
https://github.com/firecow/gitlab-ci-local/blob/master/src/utils.ts#L234