From db039d0482eac80319cf57927d3e0eb4510eb4af Mon Sep 17 00:00:00 2001 From: Ricardo Zanini Date: Tue, 4 Aug 2026 15:53:32 -0400 Subject: [PATCH 1/2] [Fix #1180] Partially revert run task changes from #1129 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Revert script arguments from array (string[]) back to object (map) to restore compatibility with the Java SDK reference implementation. Remove stdin from script process since embedded script engines (GraalJS, Jython) have no real stdin pipe — users who need stdin with scripts should use run:shell instead. Shell arguments remain as string[] since positional argv is the convention for shell commands. - Schema: revert arguments type for script to map, remove script stdin - Restore run-script-with-arguments.yaml example (map-based) - Delete run-script-with-stdin-and-arguments.yaml (argv-based) - Add run-shell-external-script.yaml showing the pattern for running an external script via shell with stdin and arguments - Update dsl-reference.md to match schema changes Signed-off-by: Ricardo Zanini --- dsl-reference.md | 22 +++++++-------- examples/run-script-with-arguments.yaml | 17 +++++++++++ .../run-script-with-stdin-and-arguments.yaml | 28 ------------------- examples/run-shell-external-script.yaml | 21 ++++++++++++++ schema/workflow.yaml | 13 +++------ 5 files changed, 53 insertions(+), 48 deletions(-) create mode 100644 examples/run-script-with-arguments.yaml delete mode 100644 examples/run-script-with-stdin-and-arguments.yaml create mode 100644 examples/run-shell-external-script.yaml diff --git a/dsl-reference.md b/dsl-reference.md index b79d734b..1c628bc0 100644 --- a/dsl-reference.md +++ b/dsl-reference.md @@ -981,8 +981,7 @@ Enables the execution of custom scripts or code within a workflow, empowering wo | language | `string` | `yes` | The language of the script to run.
*Supported values are: [`js`](https://tc39.es/ecma262/2024/) and [`python`](https://www.python.org/downloads/release/python-3131/).* | | code | `string` | `no` | The script's code.
*Required if `source` has not been set.* | | source | [externalResource](#external-resource) | `no` | The script's resource.
*Required if `code` has not been set.* | -| stdin | `string` | `no` | A runtime expression, if any, to the script as standard input (stdin).| -| arguments | `string[]` | `no` | A list of the arguments, if any, to the script as argv | +| arguments | `map` | `no` | A key/value mapping of the arguments, if any, to use when running the configured script | | environment | `map` | `no` | A key/value mapping of the environment variables, if any, to use when running the configured script process | @@ -999,21 +998,22 @@ Enables the execution of custom scripts or code within a workflow, empowering wo ```yaml document: - dsl: 1.0.3 + dsl: '1.0.3' namespace: examples - name: run-script-example + name: run-script-with-arguments version: 1.0.0 do: - - runScript: + - setInput: + set: + message: Hello World + - log: run: script: language: js arguments: - - hello - - world - code: | - const [_, __, arg0, arg1] = process.argv; - console.log('arg > ', arg0, arg1) + message: ${ .message } + code: > + console.log(message) ``` ##### Shell Process @@ -1026,7 +1026,7 @@ Enables the execution of shell commands within a workflow, enabling workflows to |:--|:---:|:---:|:---| | command | `string` | `yes` | The shell command to run | | stdin | `string` | `no` | A runtime expression, if any, to the shell command as standard input (stdin).| -| arguments | `string[]` | `no` | A list of the arguments, if any, to the shell command as argv | +| arguments | `string[]` | `no` | A list of the arguments, if any, of the shell command to run | | environment | `map` | `no` | A key/value mapping of the environment variables, if any, to use when running the configured process | ###### Examples diff --git a/examples/run-script-with-arguments.yaml b/examples/run-script-with-arguments.yaml new file mode 100644 index 00000000..e9230ac8 --- /dev/null +++ b/examples/run-script-with-arguments.yaml @@ -0,0 +1,17 @@ +document: + dsl: '1.0.3' + namespace: examples + name: run-script-with-arguments + version: 1.0.0 +do: + - setInput: + set: + message: Hello World + - log: + run: + script: + language: js + arguments: + message: ${ .message } + code: > + console.log(message) diff --git a/examples/run-script-with-stdin-and-arguments.yaml b/examples/run-script-with-stdin-and-arguments.yaml deleted file mode 100644 index bd5752c8..00000000 --- a/examples/run-script-with-stdin-and-arguments.yaml +++ /dev/null @@ -1,28 +0,0 @@ -document: - dsl: 1.0.3 - namespace: examples - name: run-script-with-stdin-and-arguments - version: 1.0.0 -do: - - runScript: - run: - script: - language: js - stdin: "Hello Workflow" - environment: - foo: bar - arguments: - - hello - code: | - // Reading Input from STDIN - import { readFileSync } from 'node:fs'; - const stdin = readFileSync(process.stdin.fd, 'utf8'); - console.log('stdin > ', stdin) // Output: stdin > Hello Workflow - - // Reading from argv - const [_, __, arg] = process.argv; - console.log('arg > ', arg) // Output: arg > hello - - // Reading from env - const foo = process.env.foo; - console.log('env > ', foo) // Output: env > bar diff --git a/examples/run-shell-external-script.yaml b/examples/run-shell-external-script.yaml new file mode 100644 index 00000000..efb5edef --- /dev/null +++ b/examples/run-shell-external-script.yaml @@ -0,0 +1,21 @@ +document: + dsl: '1.0.3' + namespace: examples + name: run-shell-external-script + version: 1.0.0 +do: + - setInput: + set: + name: World + - greet: + input: + from: ${ .name } + run: + shell: + command: python3 /path/to/greet.py + stdin: ${ . } + arguments: + - --greeting + - Hello + environment: + LOG_LEVEL: info diff --git a/schema/workflow.yaml b/schema/workflow.yaml index 88c92bd1..8f0151e9 100644 --- a/schema/workflow.yaml +++ b/schema/workflow.yaml @@ -877,16 +877,11 @@ $defs: type: string title: ScriptLanguage description: The language of the script to run. - stdin: - type: string - title: ScriptStdin - description: A runtime expression, if any, to the script as standard input (stdin). arguments: - type: array + type: object title: ScriptArguments - description: A list of the arguments, if any, to the script as argv - items: - type: string + description: A key/value mapping of the arguments, if any, to use when running the configured script. + additionalProperties: true environment: type: object title: ScriptEnvironment @@ -931,7 +926,7 @@ $defs: arguments: type: array title: ShellArguments - description: A list of the arguments, if any, to the shell command as argv + description: A list of the arguments, if any, of the shell command to run. items: type: string environment: From 1cc6bd495219787fc0a51f9f3c4eec935f92d3c3 Mon Sep 17 00:00:00 2001 From: Ricardo Zanini <1538000+ricardozanini@users.noreply.github.com> Date: Tue, 4 Aug 2026 19:58:27 -0400 Subject: [PATCH 2/2] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- examples/run-shell-external-script.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/run-shell-external-script.yaml b/examples/run-shell-external-script.yaml index efb5edef..bfb61ec7 100644 --- a/examples/run-shell-external-script.yaml +++ b/examples/run-shell-external-script.yaml @@ -15,7 +15,7 @@ do: command: python3 /path/to/greet.py stdin: ${ . } arguments: - - --greeting - - Hello + - --greeting + - Hello environment: LOG_LEVEL: info