Gitlab ci only variables regex do not support look ahead
I was trying to use a regex with a lookahead only have a stage run in certain cases but the script is flagged invalid if I have entered a lookahead.
My section from .gitlab-ci.yml
only:
variables:
- $CI_COMMIT_MESSAGE =~ /(#force[-_]?ci(\s|$|[-_A-Z]*[-_]product1)|^((?!#force[-_]?ci).)*$)/i
The idea is here that if I mention #force-ci-product1 in my code the job runs or and that if I enter #force-ci-product2 the job doesn't run. But if there is no #force-ci part present the job will always run (eg. build all)
Unfortunately the regex causes the YML to be invalid in the gitlab ci checker. As soon as I remove or escape the ? after the (( the parser accepts the YML file but obviously my behaviour is wrong.
Tested the regex with an only ruby regex tool and there it just works so I'm unsure that GitLab is using for this and if this is just an error on the syntax checker.