Extend 'only' and 'except' to add environment variables and boolean logic
This is the original intent of #34785 (closed) that was then addressed differently, but the initial idea is valuable and allows to do more powerful improvements to Auto DevOps template (and also others).
Extending syntax, we add capabilities to select if a job should be executed or not if specific environment variables are set, extending
except. This is good since it allows to avoid creating the job if conditions are not met, saving a lot of runner resources.
This is the proposed syntax:
job: only: refs: - master - schedules - branches - tags files: - ./Dockerfile expressions: - $KUBECONFIG && $KUBE_DOMAIN
This job will be scheduled only if
refs match one of the listed items, AND a file named
./Dockerfile exists, AND if both variables
KUBE_DOMAIN are set.
except are considered in logical AND, but keys in
expressions are considered in logical OR. Syntax for
&&. If logical OR is needed, you can just use two different list items.
Note: This syntax change has to be considered alpha, and subject to change.
Links / references
Make sure these are completed before closing the issue, with a link to the relevant commit.