Introducing when expressions
Sometimes, you will want some tasks to happen based on certain conditions. To do this, you will need to use when expressions. You can think of them as if
statements for your pipelines.
Tekton evaluates when
expressions before task execution. If the described condition is met, Tekton will proceed with the task. Otherwise, the task is skipped.
When you need when
expressions, you will add them as part of the task definition in a pipeline description.
They have three properties – input
, operator
, and values
. This is what a typical when
expression would look like:
when: - input: "true" operator: in values: ["true"]
For input
, you can use a static string or a variable substitution. Typical variables would be a pipeline parameter value or the value of a previous task result.
There are two operators...