
Core Plugins and tasks If
CertifiedBranch tasks based on a rendered condition.
Core Plugins and tasks If
Branch tasks based on a rendered condition.
Renders condition and coerces it to boolean (empty string/0/null is false, everything else true). Executes then when true, _else when false, with optional errors/finally blocks.
Frequently used after previous task results to drive control flow.
type: io.kestra.plugin.core.flow.IfExamples
id: if
namespace: company.team
inputs:
- id: string
type: STRING
required: true
tasks:
- id: if
type: io.kestra.plugin.core.flow.If
condition: "{{ inputs.string == 'Condition' }}"
then:
- id: when_true
type: io.kestra.plugin.core.log.Log
message: "Condition was true"
else:
- id: when_false
type: io.kestra.plugin.core.log.Log
message: "Condition was false"
Properties
then *RequiredNon-dynamicarray
1List of tasks to execute if the condition is true
condition string
The If condition which can be any expression that evaluates to a boolean value.
Boolean coercion allows 0, -0, null and '' to evaluate to false, all other values will evaluate to true.
else Non-dynamicarray
List of tasks to execute if the condition is false
errors Non-dynamicarray
List of tasks to execute in case of errors of a child task
finally Non-dynamicarray
pluginDefaultsRef Non-dynamicstring
Reference (ref) of the pluginDefaults to apply to this task.
Outputs
evaluationResult boolean
Condition evaluation result