Groovy ScriptTrigger

Groovy ScriptTrigger

Certified

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.

yaml
type: io.kestra.plugin.scripts.groovy.ScriptTrigger

Trigger when structured vars report ready.

yaml
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

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.

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.

Defaultfalse

Specifies whether a trigger is allowed to start a new execution even if a previous run is still in progress.

Defaultgroovy

Container image

Image used by the underlying Groovy task on each poll. Defaults to groovy.

Defaulttrue

Edge 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.

DefaultPT1M
Formatduration

Check interval

Interval between fresh executions of the configured script or commands. Defaults to PT60S.

SubTypestring
Possible Values
CREATEDSUBMITTEDRUNNINGPAUSEDRESTARTEDKILLINGSUCCESSWARNINGFAILEDKILLEDCANCELLEDQUEUEDRETRYINGRETRIEDSKIPPEDBREAKPOINTRESUBMITTED

List of execution states after which a trigger should be stopped (a.k.a. disabled).

Defaulttrue

A 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.

Rendered condition

Rendered exitCondition for this poll.

Process exit code

Groovy task exit code, or null when unavailable. Unknown codes never match 'exit N'.

Formatdate-time

Poll timestamp

Time the Groovy task finished for this poll.

Structured script vars

Values emitted by the task using ::{"outputs": {...}}::, including values emitted before a process failure.