Skip to content

Extend syntax for variables expressions.

What does this MR do?

Add support for operator precedence and operator grouping. && and || operators added.

For example:

only:
  variables:
    - "($CI_COMMIT_REF_NAME == 'master' || $CI_VARIABLE_2) && $CI_OTHER_VARIABLE"

Are there points in the code the reviewer needs to double check?

Yes, in lib/gitlab/ci/pipeline/expression/parser.rb. Specially the #tokens_rpn method that implements the Shunting-yard algorithm and #tree that converts the expression tokens (in Reverse Polish Notation) into an AST.

Why was this MR needed?

These changes try to extend the current ruleset as explained here

Does this MR meet the acceptance criteria?

I need to check with @ayufan

What are the relevant issue numbers?

Closes #43656 (closed) gitlab#31085 (closed)

Edited by Ben Bodenmiller

Merge request reports