From fd0d67f5b471c58599d074ae2e471f4e50b3a68f Mon Sep 17 00:00:00 2001 From: Charles d'Avernas Date: Wed, 7 Aug 2024 12:20:29 +0200 Subject: [PATCH 1/3] Updates both the DSL reference and schema to include script arguments Signed-off-by: Charles d'Avernas --- dsl-reference.md | 7 +++++-- schema/workflow.yaml | 7 ++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/dsl-reference.md b/dsl-reference.md index c4ce431a..aaf4afdc 100644 --- a/dsl-reference.md +++ b/dsl-reference.md @@ -786,7 +786,8 @@ Enables the execution of custom scripts or code within a workflow, empowering wo | language | `string` | `yes` | The language of the script to run | | 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.* | -| environment | `map` | `no` | A key/value mapping of the environment variables, if any, to use when running the configured process | +| arguments | `map` | `no` | A list of the arguments of the script to run | +| environment | `map` | `no` | A key/value mapping of the environment variables, if any, to use when running the configured script process | ###### Examples @@ -801,8 +802,10 @@ do: run: script: language: js + arguments: + greetings: Hello, world! code: > - Some cool multiline script + console.log(greetings) ``` ##### Shell Process diff --git a/schema/workflow.yaml b/schema/workflow.yaml index 3c0e34ff..39086909 100644 --- a/schema/workflow.yaml +++ b/schema/workflow.yaml @@ -508,11 +508,16 @@ $defs: language: type: string description: The language of the script to run. + arguments: + title: ScriptArguments + type: object + additionalProperties: true + description: A key/value mapping of the arguments, if any, to use when running the configured script. environment: title: ScriptEnvironment type: object additionalProperties: true - description: A key/value mapping of the environment variables, if any, to use when running the configured process. + description: A key/value mapping of the environment variables, if any, to use when running the configured script process. oneOf: - title: ScriptInline properties: From 0f4e886698d863201666c5c50b8d91150c6fdeb3 Mon Sep 17 00:00:00 2001 From: Charles d'Avernas Date: Wed, 7 Aug 2024 13:55:24 +0200 Subject: [PATCH 2/3] Minor fix to the arguments property description Signed-off-by: Charles d'Avernas --- dsl-reference.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dsl-reference.md b/dsl-reference.md index aaf4afdc..8f158b06 100644 --- a/dsl-reference.md +++ b/dsl-reference.md @@ -786,7 +786,7 @@ Enables the execution of custom scripts or code within a workflow, empowering wo | language | `string` | `yes` | The language of the script to run | | 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.* | -| arguments | `map` | `no` | A list of the arguments of the script to run | +| arguments | `map` | `no` | A list of the arguments, if any, of the script to run | | environment | `map` | `no` | A key/value mapping of the environment variables, if any, to use when running the configured script process | ###### Examples From 0702aef73a8ec3d78cc9c128e7d4fc3ef4299755 Mon Sep 17 00:00:00 2001 From: Charles d'Avernas Date: Wed, 7 Aug 2024 15:27:40 +0200 Subject: [PATCH 3/3] Added a new example for running script with arguments Signed-off-by: Charles d'Avernas --- examples/run-script-with-arguments.yaml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 examples/run-script-with-arguments.yaml diff --git a/examples/run-script-with-arguments.yaml b/examples/run-script-with-arguments.yaml new file mode 100644 index 00000000..b8ce89fe --- /dev/null +++ b/examples/run-script-with-arguments.yaml @@ -0,0 +1,14 @@ +document: + dsl: 1.0.0-alpha1 + namespace: samples + name: run-script-with-arguments + version: 0.1.0 +do: + - log: + run: + script: + language: javascript + arguments: + message: ${ .message } + code: > + console.log(message) \ No newline at end of file