Skip to content

Commit 23ee151

Browse files
authored
Merge pull request #1052 from neuroglia-io/feat-process-output
Add a new `return` property to the `run` task
2 parents df6686a + 2cab5bf commit 23ee151

File tree

6 files changed

+121
-0
lines changed

6 files changed

+121
-0
lines changed

dsl-reference.md

Lines changed: 53 additions & 0 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

@@ -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>*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+
```

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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy