
Groovy CommandsTrigger
CertifiedTrigger a flow when Groovy commands match a condition
Groovy CommandsTrigger
Trigger a flow when Groovy commands match a condition
Runs its own Groovy commands on an interval through the Commands task and starts a flow when exitCondition matches. Defaults to the groovy container image and a 60-second interval.
type: io.kestra.plugin.scripts.groovy.CommandsTriggerExamples
Trigger when a Groovy command exits with code 1.
id: groovy_commands_trigger
namespace: company.team
tasks:
- id: log
type: io.kestra.plugin.core.log.Log
message: "Triggered with exitCode={{ trigger.exitCode }}"
triggers:
- id: poll
type: io.kestra.plugin.scripts.groovy.CommandsTrigger
interval: PT60S
exitCondition: "exit 1"
commands:
- groovy -e "System.exit(1)"
Properties
commands *array
Groovy commands
Executed on each poll with the same command rendering semantics as the Groovy Commands task, including runner variables such as workingDir. beforeCommands, env and taskRunner are not exposed by this trigger. Supply dependencies and configuration in the commands (for example @Grab in Groovy code, which may require network access) or container image.
exitCondition *string
Condition to match
Evaluated after each run. 'exit N' compares a known process exit code (case insensitive). Other nonempty values are regexes matched against structured vars emitted using ::{"outputs": {...}}::. Invalid or excessive regexes fall back to substring matching. Raw stdout and stderr are not matched.
allowConcurrent boolean
falseSpecifies whether a trigger is allowed to start a new execution even if a previous run is still in progress.
containerImage string
groovyContainer image
Image used by the underlying Groovy task on each poll. Defaults to groovy.
edge booleanstring
trueEdge trigger mode
When true (default), the first matching poll emits and consecutive matches are suppressed until a nonmatching poll. The last match state is stored in the flow namespace KV store, scoped to this flow and trigger. When false, each fresh matching run emits without accessing or updating KV state. Re-enabling edge mode resumes the last stored edge-mode state. This does not provide exactly-once delivery if an evaluation crashes.
interval string
PT1MdurationCheck interval
Interval between fresh executions of the configured script or commands. Defaults to PT60S.
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 exitCondition for this poll.
exitCode integer
Process exit code
Groovy task exit code, or null when unavailable. Unknown codes never match 'exit N'.
timestamp string
date-timePoll timestamp
Time the Groovy task finished for this poll.
vars object
Structured script vars
Values emitted by the task using ::{"outputs": {...}}::, including values emitted before a process failure.