
Lua CommandsTrigger
CertifiedTrigger a flow when Lua commands match a condition
Lua CommandsTrigger
Trigger a flow when Lua commands match a condition
Polls by running Lua commands in a container (default image 'nickblah/lua') and starts the flow when their result matches the condition.
type: io.kestra.plugin.scripts.lua.CommandsTriggerExamples
Trigger when a Lua command fails.
id: lua_commands_trigger
namespace: company.team
triggers:
- id: on_fail
type: io.kestra.plugin.scripts.lua.CommandsTrigger
interval: PT5S
exitCondition: "exit 1"
commands:
- lua -e 'os.exit(1)'
tasks:
- id: log
type: io.kestra.plugin.core.log.Log
message: "Triggered with exitCode={{ trigger.exitCode }} (condition={{ trigger.condition }})"
Properties
commands *array
Lua commands to execute
Commands executed in order on each poll.
exitCondition *string
Condition to match
Condition evaluated after each commands execution. The trigger emits an event only when this condition matches.
Supported forms:
- 'exit N' (example: 'exit 1'): matches when the process exit code equals N.
- Any other string: treated as a regex (or substring if regex is invalid) matched against the task's 'vars' (when commands emit ::{"outputs": ...}::). On a failed run no vars are available to match against, so only an 'exit N' condition can match a failure.
allowConcurrent boolean
falseSpecifies whether a trigger is allowed to start a new execution even if a previous run is still in progress.
containerImage string
nickblah/luaDocker image used to execute the commands
Container image used by the underlying Commands task to run Lua commands. Defaults to 'nickblah/lua'.
edge booleanstring
trueEdge trigger mode
When true (default), emit only on a transition from not matching to matching, so a condition that stays true does not fire on every poll. The previous result is kept in the namespace KV store, keyed by flow and trigger id. When false, emit on every poll that matches.
interval string
PT1MdurationCheck interval
Interval between polling evaluations.
stopAfter array
CREATEDSUBMITTEDRUNNINGPAUSEDRESTARTEDKILLINGSUCCESSWARNINGFAILEDKILLEDCANCELLEDQUEUEDRETRYINGRETRIEDSKIPPEDBREAKPOINTRESUBMITTEDList of execution states after which a trigger should be stopped (a.k.a. disabled).
when string
trueA condition that determines whether the trigger should run.
A Pebble expression evaluated at trigger time. The trigger fires only when the expression evaluates to a truthy value (true, a non-empty string, a non-zero number). Use this to gate trigger execution on dynamic runtime values such as execution labels, flow variables, or environment conditions.
Outputs
condition string
Rendered condition
Rendered value of the exitCondition property for this poll.
exitCode integer
Commands exit code
Exit code returned by the Lua process (may be null if not available).
timestamp string
date-timePoll timestamp
Timestamp when this trigger evaluation occurred.
vars object
Commands vars
Vars produced by the task (e.g. via ::{"outputs": {...}}:: convention). This is the main structured way to evaluate non-exit conditions on successful runs.