Skip to content

Commit 3983190

Browse files
committed
Add a new lifetime property to the container process
Closes #1013 Signed-off-by: Charles d'Avernas <[email protected]>
1 parent df6686a commit 3983190

File tree

4 files changed

+88
-0
lines changed

4 files changed

+88
-0
lines changed

dsl-reference.md

Lines changed: 32 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+
+ [Container Lifetime](#container-lifetime)
5859

5960
## Abstract
6061

@@ -772,6 +773,7 @@ Enables the execution of external processes encapsulated within a containerized
772773
| ports | `map` | `no` | The container's port mappings, if any |
773774
| volumes | `map` | `no` | The container's volume mappings, if any |
774775
| environment | `map` | `no` | A key/value mapping of the environment variables, if any, to use when running the configured process |
776+
| lifetime | [`containerLifetime`](#container-lifetime) | `no` | An object used to configure the container's lifetime. |
775777

776778
###### Examples
777779

@@ -1888,3 +1890,33 @@ This has the following limitations compared to runtime expressions:
18881890
```yaml
18891891
uri: https://petstore.swagger.io/v2/pet/{petId}
18901892
```
1893+
1894+
### Container Lifetime
1895+
1896+
Configures the lifetime of a container.
1897+
1898+
#### Properties
1899+
1900+
| Property | Type | Required | Description |
1901+
|----------|:----:|:--------:|-------------|
1902+
| cleanup | `string` | `yes` | The cleanup policy to use.<br>*Supported values are:<br>- `always`: the container is deleted immediately after execution.<br>-`never`: the runtime should never delete the container.<br>-`eventually`: the container is deleted after a configured amount of time after its execution.*<br>*Defaults to `never`.* |
1903+
| after | [`duration`](#duration) | `no` | The [`duration`](#duration), if any, after which to delete the container once executed.<br>*Required if `cleanup` has been set to `eventually`, otherwise ignored.* |
1904+
1905+
#### Examples
1906+
1907+
```yaml
1908+
document:
1909+
dsl: '1.0.0-alpha5'
1910+
namespace: test
1911+
name: run-container-example
1912+
version: '0.1.0'
1913+
do:
1914+
- runContainer:
1915+
run:
1916+
container:
1917+
image: fake-image
1918+
lifetime:
1919+
cleanup: eventually
1920+
after:
1921+
minutes: 30
1922+
```
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
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+
lifetime:
12+
cleanup: always
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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+
lifetime:
12+
cleanup: eventually
13+
after:
14+
minutes: 30

schema/workflow.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,10 @@ $defs:
611611
type: object
612612
title: ContainerEnvironment
613613
description: A key/value mapping of the environment variables, if any, to use when running the configured process.
614+
lifetime:
615+
$ref: '#/$defs/containerLifetime'
616+
title: ContainerLifetime
617+
description: An object, if any, used to configure the container's lifetime
614618
required: [ image ]
615619
required: [ container ]
616620
- title: RunScript
@@ -1535,3 +1539,29 @@ $defs:
15351539
title: RuntimeExpression
15361540
description: A runtime expression.
15371541
pattern: "^\\s*\\$\\{.+\\}\\s*$"
1542+
containerLifetime:
1543+
type: object
1544+
title: ContainerLifetime
1545+
description: The configuration of a container's lifetime
1546+
unevaluatedProperties: false
1547+
properties:
1548+
cleanup:
1549+
type: string
1550+
title: ContainerCleanupPolicy
1551+
description: The container cleanup policy to use
1552+
enum: [ always, never, eventually ]
1553+
default: never
1554+
after:
1555+
$ref: '#/$defs/duration'
1556+
title: ContainerLifetimeDuration
1557+
description: The duration after which to cleanup the container, in case the cleanup policy has been set to 'eventually'
1558+
required: [ cleanup ]
1559+
if:
1560+
properties:
1561+
cleanup:
1562+
const: eventually
1563+
then:
1564+
required: [ after ]
1565+
else:
1566+
not:
1567+
required: [ after ]

0 commit comments

Comments
 (0)