Skip to content

Commit 709ac30

Browse files
authored
Merge branch 'main' into feat-emit-sink
2 parents d53c269 + 52cb747 commit 709ac30

7 files changed

+144
-14
lines changed

dsl-reference.md

Lines changed: 56 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
+ [HTTP Response](#http-response)
5656
+ [HTTP Request](#http-request)
5757
+ [URI Template](#uri-template)
58+
+ [Process Result](#process-result)
5859

5960
## Abstract
6061

@@ -411,7 +412,7 @@ The [OpenAPI Call](#openapi-call) enables workflows to interact with external se
411412
|:--|:---:|:---:|:---|
412413
| document | [`externalResource`](#external-resource) | `yes` | The OpenAPI document that defines the operation to call. |
413414
| operationId | `string` | `yes` | The id of the OpenAPI operation to call. |
414-
| arguments | `map` | `no` | A name/value mapping of the parameters, if any, of the OpenAPI operation to call. |
415+
| parameters | `map` | `no` | A name/value mapping of the parameters, if any, of the OpenAPI operation to call. |
415416
| authentication | [`authentication`](#authentication) | `no` | The authentication policy, or the name of the authentication policy, to use when calling the OpenAPI operation. |
416417
| output | `string` | `no` | The OpenAPI call's output format.<br>*Supported values are:*<br>*- `raw`, which output's the base-64 encoded [http response](#http-response) content, if any.*<br>*- `content`, which outputs the content of [http response](#http-response), possibly deserialized.*<br>*- `response`, which outputs the [http response](#http-response).*<br>*Defaults to `content`.* |
417418

@@ -717,13 +718,14 @@ Provides the capability to execute external [containers](#container-process), [s
717718

718719
##### Properties
719720

720-
| Name | Type | Required | Description|
721+
| Name | Type | Required | Description |
721722
|:--|:---:|:---:|:---|
722723
| run.container | [`container`](#container-process) | `no` | The definition of the container to run.<br>*Required if `script`, `shell` and `workflow` have not been set.* |
723724
| run.script | [`script`](#script-process) | `no` | The definition of the script to run.<br>*Required if `container`, `shell` and `workflow` have not been set.* |
724725
| run.shell | [`shell`](#shell-process) | `no` | The definition of the shell command to run.<br>*Required if `container`, `script` and `workflow` have not been set.* |
725726
| run.workflow | [`workflow`](#workflow-process) | `no` | The definition of the workflow to run.<br>*Required if `container`, `script` and `shell` have not been set.* |
726-
| await | `boolean` | `no` | Determines whether or not the process to run should be awaited for.<br>*Defaults to `true`.* |
727+
| await | `boolean` | `no` | Determines whether or not the process to run should be awaited for.<br>*When set to `false`, the task cannot wait for the process to complete and thus cannot output the process’s result. In this case, it should simply output its transformed input.*<br>*Defaults to `true`.* |
728+
| return | `string` | `no` | Configures the output of the process.<br>*Supported values are:*<br>*- `stdout`: Outputs the content of the process **STDOUT**.*<br>*- `stderr`: Outputs the content of the process **STDERR**.*<br>*- `code`: Outputs the process's **exit code**.*<br>*- `all`: Outputs the **exit code**, the **STDOUT** content and the **STDERR** content, wrapped into a new [processResult](#process-result) object.*<br>*- `none`: Does not output anything.*<br>*Defaults to `stdout`.* |
727729

728730
##### Examples
729731

@@ -1889,3 +1891,54 @@ This has the following limitations compared to runtime expressions:
18891891
```yaml
18901892
uri: https://petstore.swagger.io/v2/pet/{petId}
18911893
```
1894+
1895+
### Process Result
1896+
1897+
Describes the result of a process.
1898+
1899+
#### Properties
1900+
1901+
| Name | Type | Required | Description|
1902+
|:--|:---:|:---:|:---|
1903+
| code | `integer` | `yes` | The process's exit code. |
1904+
| stdout | `string` | `yes` | The process's **STDOUT** output. |
1905+
| stderr | `string` | `yes` | The process's **STDERR** output. |
1906+
1907+
#### Examples
1908+
1909+
```yaml
1910+
document:
1911+
dsl: '1.0.0-alpha5'
1912+
namespace: test
1913+
name: run-example
1914+
version: '0.1.0'
1915+
do:
1916+
- runContainer:
1917+
run:
1918+
container:
1919+
image: fake-image
1920+
return: stderr
1921+
1922+
- runScript:
1923+
run:
1924+
script:
1925+
language: js
1926+
code: >
1927+
Some cool multiline script
1928+
return: code
1929+
1930+
- runShell:
1931+
run:
1932+
shell:
1933+
command: 'echo "Hello, ${ .user.name }"'
1934+
return: all
1935+
1936+
- runWorkflow:
1937+
run:
1938+
workflow:
1939+
namespace: another-one
1940+
name: do-stuff
1941+
version: '0.1.0'
1942+
input: {}
1943+
return: none
1944+
```

dsl.md

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -343,18 +343,20 @@ When the evaluation of an expression fails, runtimes **must** raise an error wit
343343
| input | `any` | The task's transformed input. |
344344
| output | `any` | The task's transformed output. |
345345
| secrets | `map` | A key/value map of the workflow secrets.<br>To avoid unintentional bleeding, secrets can only be used in the `input.from` runtime expression. |
346+
| authorization | [`authorizationDescriptor`](#authorization-descriptor) | Describes the resolved authorization, as defined by the task's authentication, if any. |
346347
| task | [`taskDescriptor`](#task-descriptor) | Describes the current task. |
347348
| workflow | [`workflowDescriptor`](#workflow-descriptor) | Describes the current workflow. |
348349
| runtime | [`runtimeDescriptor`](#runtime-descriptor) | Describes the runtime. |
349350

351+
350352
##### Runtime Descriptor
351353

352354
This argument contains information about the runtime executing the workflow.
353355

354356
| Name | Type | Description | Example |
355-
|:-----|:----:|:------------| ------- |
357+
|:-----|:----:|:------------|:--------|
356358
| name | `string` | A human friendly name for the runtime. | `Synapse`, `Sonata` |
357-
| version | `string` | The version of the runtime. This can be an arbitrary string | a incrementing positive integer (`362`), semantic version (`1.4.78`), commit hash (`04cd3be6da98fc35422c8caa821e0aa1ef6b2c02`) or container image label (`v0.7.43-alpine`) |
359+
| version | `string` | The version of the runtime. This can be an arbitrary string | An incrementing positive integer (`362`), semantic version (`1.4.78`), commit hash (`04cd3be6da98fc35422c8caa821e0aa1ef6b2c02`) or container image label (`v0.7.43-alpine`) |
358360
| metadata | `map` | An object/map of implementation specific key-value pairs. This can be chosen by runtime implementors and usage of this argument signals that a given workflow definition might not be runtime agnostic | A Software as a Service (SaaS) provider might choose to expose information about the tenant the workflow is executed for e.g. `{ "organization": { "id": "org-ff51cff2-fc83-4d70-9af1-8dacdbbce0be", "name": "example-corp" }, "featureFlags": ["fastZip", "arm64"] }`. |
359361

360362
##### Workflow Descriptor
@@ -377,6 +379,13 @@ This argument contains information about the runtime executing the workflow.
377379
| output | `any` | The task's *raw* output (i.e. *BEFORE* the `output.as` expression). | |
378380
| startedAt | [`dateTimeDescriptor`](#datetime-descriptor) | The start time of the task | |
379381

382+
##### Authorization Descriptor
383+
384+
| Name | Type | Description | Example |
385+
|:-------|:------:|:------------|:--------|
386+
| scheme | `string` | The resolved authorization scheme. | `Bearer` |
387+
| parameter | `string` | The resolved authorization parameter. | `eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJVadQssw5c` |
388+
380389
##### DateTime Descriptor
381390

382391
| Name | Type | Description | Example |
@@ -387,15 +396,15 @@ This argument contains information about the runtime executing the workflow.
387396

388397
The following table shows which arguments are available for each runtime expression:
389398

390-
| Runtime Expression | Evaluated on | Produces | `$context` | `$input` | `$output` | `$secrets` | `$task` | `$workflow` |
391-
|:-------------------|:---------:|:---------:|:---------:|:---------:|:-------:|:---------:|:-------:|:----------:|
392-
| Workflow `input.from` | Raw workflow input | Transformed workflow input | | | || ||
393-
| Task `input.from` | Raw task input (i.e. transformed workflow input for the first task, transformed output from previous task otherwise) | Transformed task input || | ||||
394-
| Task `if` | Transformed task input | ||| ||||
395-
| Task definition | Transformed task input | ||| ||||
396-
| Task `output.as` | Raw task output | Transformed task output ||| ||||
397-
| Task `export.as` | Transformed task output | `$context` |||||||
398-
| Workflow `output.as` | Last task's transformed output | Transformed workflow output || | || ||
399+
| Runtime Expression | Evaluated on | Produces | `$context` | `$input` | `$output` | `$secrets` | `$task` | `$workflow` | `$runtime` | `$authorization` |
400+
|:-------------------|:---------:|:---------:|:---------:|:---------:|:-------:|:---------:|:-------:|:----------:|:----------:|:----------:|
401+
| Workflow `input.from` | Raw workflow input | Transformed workflow input | | | || ||| |
402+
| Task `input.from` | Raw task input (i.e. transformed workflow input for the first task, transformed output from previous task otherwise) | Transformed task input || | ||||| |
403+
| Task `if` | Transformed task input | ||| ||||| |
404+
| Task definition | Transformed task input | ||| ||||||
405+
| Task `output.as` | Raw task output | Transformed task output ||| ||||||
406+
| Task `export.as` | Transformed task output | `$context` |||||||||
407+
| Workflow `output.as` | Last task's transformed output | Transformed workflow output || | || ||| |
399408

400409
### Fault Tolerance
401410

examples/run-return-all.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
document:
2+
dsl: '1.0.0-alpha5'
3+
namespace: test
4+
name: run-container
5+
version: '0.1.0'
6+
do:
7+
- runContainer:
8+
run:
9+
container:
10+
image: hello-world
11+
return: all

examples/run-return-code.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
document:
2+
dsl: '1.0.0-alpha5'
3+
namespace: test
4+
name: run-container
5+
version: '0.1.0'
6+
do:
7+
- runContainer:
8+
run:
9+
container:
10+
image: hello-world
11+
return: code

examples/run-return-none.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
document:
2+
dsl: '1.0.0-alpha5'
3+
namespace: test
4+
name: run-container
5+
version: '0.1.0'
6+
do:
7+
- runContainer:
8+
run:
9+
container:
10+
image: hello-world
11+
return: none

examples/run-return-stderr.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
document:
2+
dsl: '1.0.0-alpha5'
3+
namespace: test
4+
name: run-container
5+
version: '0.1.0'
6+
do:
7+
- runContainer:
8+
run:
9+
container:
10+
image: hello-world
11+
return: stderr

schema/workflow.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,12 @@ $defs:
585585
default: true
586586
title: AwaitProcessCompletion
587587
description: Whether to await the process completion before continuing.
588+
return:
589+
type: string
590+
title: ProcessReturnType
591+
description: Configures the output of the process.
592+
enum: [ stdout, stderr, code, all, none ]
593+
default: stdout
588594
oneOf:
589595
- title: RunContainer
590596
description: Enables the execution of external processes encapsulated within a containerized environment.
@@ -1539,3 +1545,21 @@ $defs:
15391545
title: RuntimeExpression
15401546
description: A runtime expression.
15411547
pattern: "^\\s*\\$\\{.+\\}\\s*$"
1548+
processResult:
1549+
type: object
1550+
title: ProcessResult
1551+
description: The object returned by a run task when its return type has been set 'all'
1552+
properties:
1553+
code:
1554+
type: integer
1555+
title: ProcessExitCode
1556+
description: The process's exit code.
1557+
stdout:
1558+
type: string
1559+
title: ProcessStandardOutput
1560+
description: The content of the process's STDOUT
1561+
stderr:
1562+
type: string
1563+
title: ProcessStandardError
1564+
description: The content of the process's STDERR
1565+
required: [ code, stdout, stderr ]

0 commit comments

Comments
 (0)