CI `except` with refs AND variables is ignoring variable condition

Summary

With CI only and according to documentation, using the complex syntax we get OR inside (so for refs:, at least one being true, the refs: part is true), and we get AND when evaluating refs: + variables: (with again OR inside variables).

That means:

  only:
    refs: # AND
      - branches # OR
      - tags # OR
      - triggers # OR
    variables: # AND
      - $GITLAB_DEV # OR

So any of these combinations should be "true":

  • branches AND $GITLAB_DEV
  • tags AND $GITLAB_DEV
  • trigger AND $GITLAB_DEV

when trying except with same structure, it's ignoring the variables: condition, and skipping whenever one of the refs: match.

CI except (complex) doesn't behave in a predictable way as only (complex) does.

Steps to reproduce

do_something:
  script:
    - echo "I should print this unless $SOMECRAZYVAR is defined"
  except:
    - branches
    - tags
    - triggers
   variables:
     - $SOMECRAZYVAR

Example Project

omnibus-gitlab!2659 (closed)

What is the current bug behavior?

looks like except: is not doing logical AND with refs: and variables:

What is the expected correct behavior?

it should do logical AND with refs: and variables:

Possible fixes

Assignee Loading
Time tracking Loading