Skip to content

Commit 80eea36

Browse files
authored
Merge branch 'main' into feat-document-async-task-output
2 parents 9b7bf32 + 691ca1f commit 80eea36

7 files changed

+142
-12
lines changed

dsl-reference.md

Lines changed: 54 additions & 1 deletion
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

@@ -723,6 +724,7 @@ Provides the capability to execute external [containers](#container-process), [s
723724
| 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.* |
724725
| run.workflow | [`workflow`](#workflow-process) | `no` | The definition of the workflow to run.<br>*Required if `container`, `script` and `shell` have not been set.* |
725726
| 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`.* |
727+
| 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`.* |
726728

727729
##### Examples
728730

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

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
@@ -581,6 +581,12 @@ $defs:
581581
default: true
582582
title: AwaitProcessCompletion
583583
description: Whether to await the process completion before continuing.
584+
return:
585+
type: string
586+
title: ProcessReturnType
587+
description: Configures the output of the process.
588+
enum: [ stdout, stderr, code, all, none ]
589+
default: stdout
584590
oneOf:
585591
- title: RunContainer
586592
description: Enables the execution of external processes encapsulated within a containerized environment.
@@ -1535,3 +1541,21 @@ $defs:
15351541
title: RuntimeExpression
15361542
description: A runtime expression.
15371543
pattern: "^\\s*\\$\\{.+\\}\\s*$"
1544+
processResult:
1545+
type: object
1546+
title: ProcessResult
1547+
description: The object returned by a run task when its return type has been set 'all'
1548+
properties:
1549+
code:
1550+
type: integer
1551+
title: ProcessExitCode
1552+
description: The process's exit code.
1553+
stdout:
1554+
type: string
1555+
title: ProcessStandardOutput
1556+
description: The content of the process's STDOUT
1557+
stderr:
1558+
type: string
1559+
title: ProcessStandardError
1560+
description: The content of the process's STDERR
1561+
required: [ code, stdout, stderr ]

0 commit comments

Comments
 (0)