Skip to content

feat(scripts): add support for zx Script and Commands tasks - #464

Open
e-esakman wants to merge 2 commits into
kestra-io:mainfrom
e-esakman:zx-script
Open

e-esakman wants to merge 2 commits into
kestra-io:mainfrom
e-esakman:zx-script

Conversation

@e-esakman

@e-esakman e-esakman commented Oct 12, 2026 •

Copy link
Copy Markdown

What changes are being made and why?

Adds dedicated zx support for running JavaScript shell automation in Kestra workflows.

The new plugin-script-zx module provides:

  • io.kestra.plugin.scripts.zx.Script for inline JavaScript with top-level await.
  • io.kestra.plugin.scripts.zx.Commands for existing script files and shell commands.

Both tasks reuse Kestra's task runners and support input files, environment variables, preparation commands, and output files. Includes plugin metadata, official zx icons, documentation, and tests.

Closes #236.


Screenshots ( After )

zx plugin screenshot 1 zx plugin screenshot 2

How the changes have been QAed?

Automated validation:

  • All 5 tests passed, including the sanity-check flow.
  • All 25 documentation rules passed.
  • Formatting checks and JAR packaging passed.

Manual validation in a local Kestra 1.3.39 instance confirmed:

  • Both tasks appeared with their icons, documentation, and properties.
  • Inline scripts and existing files executed successfully.
  • Logs and downloaded output files contained the expected content.
  • An uncaught shell-command failure correctly failed the task.
  • Process execution and a custom Docker image worked with executable: zx.

Reproducible QA flow:

id: zx_manual_qa
namespace: company.team

tasks:
  - id: inline
    type: io.kestra.plugin.scripts.zx.Script
    outputFiles:
      - greeting.txt
    script: |
      import { writeFile } from 'node:fs/promises';
      $.verbose = false;
      const result = await $`echo Hello Kestra`;
      console.log(result.stdout.trim());
      await writeFile('greeting.txt', result.stdout);

  - id: existing_file
    type: io.kestra.plugin.scripts.zx.Commands
    inputFiles:
      main.mjs: |
        $.verbose = false;
        console.log((await $`echo Commands works`).stdout.trim());
    commands:
      - node /zx/build/cli.js main.mjs

Expected: both tasks succeed, logs show Hello Kestra and Commands works, and greeting.txt is available for download.

image

Setup Instructions

  • Default execution requires Docker access. The default image includes Node.js, zx, and Bash.
  • ghcr.io/google/zx:8.5.0 is AMD64; ARM64 workers require emulation or a compatible custom image.
  • For custom images or Process execution with zx installed on PATH, set executable: zx on the Script task. Process workers require Node.js, zx, and a supported shell.

Contributor Checklist ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: To review

Development

Successfully merging this pull request may close these issues.

Consider Google zx script as alternative to Bash

1 participant