Job except condition involving refs AND variables is not working as expected

Summary

Job's except: option doesn't behave how the documentation says it should.

Steps to reproduce

Create a project with this .gitlab-ci.yml file:

test-job:
  script: echo "I'm being built!"

test-except-d1:
  script: echo $DMD
  variables:
    DMD: 1.081.*
  except:
    refs:
      - /\+d2$/
    variables:
      - $DMD =~ /^1\./

test-except-d2:
  script: echo $DMD
  variables:
    DMD: 2.071.2.s*
  except:
    refs:
      - /\+d2$/
    variables:
      - $DMD =~ /^1\./

And do some tags to test the condition.

Example Project

https://gitlab.com/sociomantic-test/gitlab-bug-test

What is the current bug behavior?

What is the expected correct behavior?

According to https://docs.gitlab.com/12.1/ee/ci/yaml/README.html#onlyexcept-advanced I understand this should happen:

  • test-job, test-except-d1 and test-except-d2 to be run for the master branch.
  • test-job, test-except-d1 and test-except-d2 to be run for the v1.0.0 tag.
  • test-job and test-except-d2 to be run and test-except-d1 not to be run for the v1.0.0+d2 tag.

Relevant logs and/or screenshots

None

Output of checks

This bug happens on GitLab.com

Results of GitLab environment info

This bug happens on GitLab.com

Results of GitLab application Check

This bug happens on GitLab.com

Possible fixes

No idea.

Edited by Ghost User