Skip to content

support negated string and match conditions in gitlab-ci.yml

For gitlab.com deployment pipelines we use variables for running subsets of the very long pipeline that deploys from staging->cny->production.

In order to add this logic to our gitlab-ci.yml we would like the following conditional:

only:
  variables:
    - $SOME_VAR != 'some value'
    - $GITLAB_ENV == 'something'
    - $GITLAB_ENV == 'something else'
    ....

Where it is understood that these variable conditions are OR'd together.

The $SOME_VAR != 'some value' is not supported in variable syntax.

Also, because we use re2 for pattern matching we cannot use a negative lookahead for a variable not matching a string.

This issue is to add support for negated string and match conditions:

- $SOME_VAR != 'something string'
- $SOME_VAR !~ /some pattern/

Related

Edited by John Jarvis