JBang CommandsTrigger

JBang CommandsTrigger

Certified

Trigger a flow when JBang commands match a condition

Polls by running JBang commands in a script container (default image jbangdev/jbang-action) and emits when exitCondition matches. Edge mode (the default) emits only on a transition from not matching to matching, remembering the previous result in the namespace KV store. Polls every 60s by default. Accepts 'exit N' or a regex (fallback substring) matched against emitted vars; a failed run has no vars, so only 'exit N' can match a failure.

yaml
type: io.kestra.plugin.scripts.jbang.CommandsTrigger

Trigger when commands fail with a specific exit code (exit 42).

yaml
id: commands_trigger
namespace: company.team

triggers:
  - id: commands_failure
    type: io.kestra.plugin.scripts.jbang.CommandsTrigger
    interval: PT60S
    exitCondition: "exit 42"
    edge: true
    containerImage: jbangdev/jbang-action
    commands:
      - exit 42

tasks:
  - id: log
    type: io.kestra.plugin.core.log.Log
    message: "Triggered with exitCode={{ trigger.exitCode }} (condition={{ trigger.condition }})"
Properties
SubTypestring

JBang commands to execute

Commands executed on each poll (same semantics as the JBang Commands task).

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 42'): 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. Note that JBang itself exits with 1 on compile errors and unresolvable //DEPS, so prefer a dedicated exit code (e.g. 'exit 42') for the condition you watch.
Defaultfalse

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

Defaultjbangdev/jbang-action

Docker image used to execute the commands

Container image used by the underlying Commands task to run JBang commands. Defaults to 'jbangdev/jbang-action'.

Defaulttrue

Edge trigger mode

If true (default), the trigger emits only on a transition from 'not matching' to 'matching' (anti-spam). The previous result is kept in the namespace KV store, keyed by flow and trigger id. If false, the trigger emits on every poll where the condition matches.

DefaultPT1M
Formatduration

Check interval

Interval between polling evaluations.

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 value of the exitCondition property for this poll.

Commands exit code

Exit code returned by the JBang process (may be null if not available).

Formatdate-time

Timestamp of the event that fired the trigger

Commands vars

Vars produced by the task (e.g. via ::{"outputs": {...}}:: convention).