Skip to content

Commit 9ef6f2a

Browse files
committed
Add support for dynamic container names via runtime expressions
- Introduced a new optional `name` property in run container tasks, allowing users to define container names dynamically using runtime expressions. - Updated the DSL reference with the new `name` field, detailing its usage and linking to runtime expression documentation. - Added support for the `name` property in the YAML version of the JSON schema. - Included an example demonstrating dynamic container naming based on workflow and task metadata. This enhancement provides improved observability, debugging, and alignment with organizational conventions for container management. Closes #1056 Signed-off-by: Jean-Baptiste Bianchi <[email protected]>
1 parent 08af9e2 commit 9ef6f2a

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

dsl-reference.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -796,6 +796,7 @@ Enables the execution of external processes encapsulated within a containerized
796796
| Name | Type | Required | Description |
797797
|:--|:---:|:---:|:---|
798798
| image | `string` | `yes` | The name of the container image to run |
799+
| name | `string` | `no` | A [runtime expression](dsl.md#runtime-expressions) used to give specific name to the container, if any. |
799800
| command | `string` | `no` | The command, if any, to execute on the container |
800801
| ports | `map` | `no` | The container's port mappings, if any |
801802
| volumes | `map` | `no` | The container's volume mappings, if any |

examples/run-container-with-name.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-with-name
5+
version: '0.1.0'
6+
do:
7+
- runContainer:
8+
run:
9+
container:
10+
image: hello-world
11+
name: ${ "hello-\(.workflow.document.name)-\(.task.name)-\(.workflow.id)" }

schema/workflow.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,10 @@ $defs:
622622
type: string
623623
title: ContainerImage
624624
description: The name of the container image to run.
625+
name:
626+
type: string
627+
title: ContainerName
628+
description: A runtime expression used to give specific name to the container, if any.
625629
command:
626630
type: string
627631
title: ContainerCommand

0 commit comments

Comments
 (0)