
Groovy ScriptTrigger
CertifiedTrigger a flow when a Groovy script matches a condition
Groovy ScriptTrigger
Trigger a flow when a Groovy script matches a condition
Runs its own Groovy script on an interval through the Script 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.ScriptTriggerExamples
Trigger when structured vars report ready.
id: groovy_script_trigger
namespace: company.team
tasks:
- id: log
type: io.kestra.plugin.core.log.Log
message: "Triggered with exitCode={{ trigger.exitCode }} (vars={{ trigger.vars }})"
triggers:
- id: poll
type: io.kestra.plugin.scripts.groovy.ScriptTrigger
interval: PT60S
exitCondition: "ready"
script: |
println '::{"outputs":{"status":"ready"}}::'
Properties
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.
script *string
Groovy script
Executed on each poll with the same script rendering semantics as the Groovy Script task, including runner variables such as workingDir. beforeCommands, env and taskRunner are not exposed by this trigger. Supply dependencies and configuration in the script (for example @Grab, which may require network access) or container image.
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.