Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions dsl-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.<br>*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.<br>*Required if `source` has not been set.* |
| source | [externalResource](#external-resource) | `no` | The script's resource.<br>*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 |


Expand All @@ -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:
Comment thread
ricardozanini marked this conversation as resolved.
- 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
Expand All @@ -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
Expand Down
17 changes: 17 additions & 0 deletions examples/run-script-with-arguments.yaml
Original file line number Diff line number Diff line change
@@ -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)
28 changes: 0 additions & 28 deletions examples/run-script-with-stdin-and-arguments.yaml

This file was deleted.

21 changes: 21 additions & 0 deletions examples/run-shell-external-script.yaml
Original file line number Diff line number Diff line change
@@ -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
13 changes: 4 additions & 9 deletions schema/workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
Loading