Conditional Jobs in CI for use with environments

I want to run a conditional build that is triggered by an api trigger, but only when the ref passed in by the trigger matches a specific regex. I can imagine 2 ways this could be done:

Logical operators in .gitlab-ci.yml's only: directive like so:

only:
   - /^staging-v.*$/ AND triggers

or

Controlling the result status using return codes

script:
   - return 3;

could interpreted as "not run" or "skipped"

This would be handy with the new environments feature of GitLab 8.9.

Edited Jul 27, 2020 by Jason Yavorsky
Assignee Loading
Time tracking Loading