Skip to content

Introduce ScriptTrigger & CommandsTrigger for each sub plugin #313

Closed
5 of 5 issues completed
Closed

Description

@fdelbrayelle

Feature description

Context

We want each submodule of plugin-scripts to expose two triggers:

  • ScriptTrigger
  • CommandsTrigger

The goal is to allow a flow to be triggered whenever:

  • the underlying script command is executed (ScriptTrigger)
  • all the commands from the Commands task is executed (CommandsTrigger)

In addition, each trigger must support an exit condition so the trigger can decide whether it emits an event depending on the execution result.

Example: for plugin-script-shell we should be able to configure:

  • exitCondition: "exit 1" (or similar) to trigger only on failed execution.

✅ What to implement

For each sub-plugin in plugin-scripts, add:

1. ScriptTrigger

  • Triggers when the sub-plugin script execution is performed.
  • Must emit an event containing:
    • command executed
    • arguments
    • env (if available)
    • exitCode
    • stdout / stderr (if capture is enabled)
    • relevant contextual metadata (execution id, namespace, flow id, etc.)

2. CommandsTrigger

  • Triggers when the commands task is executed (the multi-commands task of the sub-plugin).
  • Must emit an event containing:
    • list of commands executed (or the matched one)
    • exit code(s)
    • stdout/stderr if available
    • metadata (execution id, namespace, flow id, etc.)

🔧 Trigger configuration requirements

Each trigger should accept at least:

  • commandPattern (string / regex / glob)
  • argumentsPattern (optional)
  • exitCondition (string expression)

Where exitCondition can match on:

  • exit code (exitCode == 1)
  • output (stdout contains "...")
  • or a literal shell-style condition (ex: "exit 1" for shell plugin)

Example YAML

triggers:
  - id: on_shell_fail
    type: io.kestra.plugin.scripts.shell.triggers.ScriptTrigger
    commandPattern: ".*"
    exitCondition: "exit 1"

triggers:
  - id: on_any_commands
    type: io.kestra.plugin.scripts.shell.triggers.CommandsTrigger
    commandPattern: ".*"
    exitCondition: "exit 0"

Sub-issues

Sub-issues

5 of 5 Issues completed
Loading 5 sub-issues

Activity

  1. added
    kind/cooldown
    area/plugin
    on Dec 24, 2025
  2. self-assigned this
    on Jan 14, 2026
  3. rishi-jat commented on Mar 3, 2026

    @rishi-jat
    Contributor

    @fdelbrayelle could you assign this whole issue to me ? or should I target sub issues ? Thanks!

  4. 5 remaining items

  5. Pradumnasaraf commented on May 26, 2026

    @Pradumnasaraf
    Member

    Shell and Python triggers are working as expected, but the Go, Ruby and Node triggers do not create executions. Reopened the respective issues.

    #321 (comment)
    #320 (comment)
    #319 (comment)

  6. changed the issue type fromtoon May 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area/pluginkind/cooldown

Type

Fields

Stage

Done

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions