Use jobs.<job_id>.if
to skip a job, not to force running it if an upstream job failed.
You can use any supported context and expression to create a conditional.
When you use expressions in an if
conditional, you may omit the ${{ }}
expression syntax because CloudBees automatically evaluates the if
conditional as an expression.
However, this rule does not apply everywhere.
You must use the ${{ }}
expression syntax or escape with ''
, ""
, or ()
when the expression starts with !
, since !
is reserved notation in YAML format.
Using the ${{ }}
expression syntax turns the contents into a string, and strings are truthy.
For example, if: true && ${{ false }}
evaluates to true
.
CloudBees strongly recommends that you avoid mixing use of the ${{ }} expression with other logic, as you may get unexpected results.
|
Contexts
Conditionals can be at both the job and step level. A conditional within a job cannot reference any step outputs, because some steps have not yet run.