
R ScriptTrigger
CertifiedTrigger a flow when an R script matches a condition
R ScriptTrigger
Trigger a flow when an R script matches a condition
Polls by running an inline R script in a container (default image 'r-base') and starts the flow when its result matches the condition.
type: io.kestra.plugin.scripts.r.ScriptTriggerExamples
Trigger when the script fails with exit code 1.
id: r_script_trigger
namespace: company.team
triggers:
- id: script_failure
type: io.kestra.plugin.scripts.r.ScriptTrigger
interval: PT10S
exitCondition: "exit 1"
edge: true
script: |
stop("boom")
tasks:
- id: log
type: io.kestra.plugin.core.log.Log
message: "Triggered with exitCode={{ trigger.exitCode }} (condition={{ trigger.condition }})"
Properties
exitCondition *string
Condition to match
Condition evaluated after each execution. The trigger emits only when it matches. 'exit N' compares the exit code, otherwise the string is used as a regex (or substring fallback) against emitted vars and failure logs.
script *string
Inline R script
Multi-line R script executed on each poll, with the same semantics as the R Script task.
allowConcurrent boolean
falseSpecifies whether a trigger is allowed to start a new execution even if a previous run is still in progress.
containerImage string
r-baseContainer image for script execution
Image used by the Script task to run the inline R script; defaults to 'r-base'. Provide an image that includes the required CRAN packages, or install them in the script itself.
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
Script exit code
Exit code returned by the R process (may be null if not available).
timestamp string
date-timePoll timestamp
Timestamp when this trigger evaluation occurred.
vars object
Script 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.