From 9ef6f2ac350e10b98ca1b73f419eeee2598dbea8 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Bianchi Date: Fri, 10 Jan 2025 12:32:22 +0100 Subject: [PATCH 1/3] 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 --- dsl-reference.md | 1 + examples/run-container-with-name.yaml | 11 +++++++++++ schema/workflow.yaml | 4 ++++ 3 files changed, 16 insertions(+) create mode 100644 examples/run-container-with-name.yaml diff --git a/dsl-reference.md b/dsl-reference.md index ac9e1261..318140bb 100644 --- a/dsl-reference.md +++ b/dsl-reference.md @@ -796,6 +796,7 @@ Enables the execution of external processes encapsulated within a containerized | Name | Type | Required | Description | |:--|:---:|:---:|:---| | image | `string` | `yes` | The name of the container image to run | +| name | `string` | `no` | A [runtime expression](dsl.md#runtime-expressions) used to give specific name to the container, if any. | | command | `string` | `no` | The command, if any, to execute on the container | | ports | `map` | `no` | The container's port mappings, if any | | volumes | `map` | `no` | The container's volume mappings, if any | diff --git a/examples/run-container-with-name.yaml b/examples/run-container-with-name.yaml new file mode 100644 index 00000000..45fd36a0 --- /dev/null +++ b/examples/run-container-with-name.yaml @@ -0,0 +1,11 @@ +document: + dsl: '1.0.0-alpha5' + namespace: test + name: run-container-with-name + version: '0.1.0' +do: + - runContainer: + run: + container: + image: hello-world + name: ${ "hello-\(.workflow.document.name)-\(.task.name)-\(.workflow.id)" } \ No newline at end of file diff --git a/schema/workflow.yaml b/schema/workflow.yaml index 936a1c05..198d804a 100644 --- a/schema/workflow.yaml +++ b/schema/workflow.yaml @@ -622,6 +622,10 @@ $defs: type: string title: ContainerImage description: The name of the container image to run. + name: + type: string + title: ContainerName + description: A runtime expression used to give specific name to the container, if any. command: type: string title: ContainerCommand From f37a7d4bf82a68be932684f274ab5a62064057fa Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Bianchi Date: Fri, 10 Jan 2025 13:03:08 +0100 Subject: [PATCH 2/3] Update dsl-reference.md Signed-off-by: Jean-Baptiste Bianchi Co-authored-by: Charles d'Avernas --- dsl-reference.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dsl-reference.md b/dsl-reference.md index 318140bb..21b6a829 100644 --- a/dsl-reference.md +++ b/dsl-reference.md @@ -796,7 +796,7 @@ Enables the execution of external processes encapsulated within a containerized | Name | Type | Required | Description | |:--|:---:|:---:|:---| | image | `string` | `yes` | The name of the container image to run | -| name | `string` | `no` | A [runtime expression](dsl.md#runtime-expressions) used to give specific name to the container, if any. | +| name | `string` | `no` | A [runtime expression](dsl.md#runtime-expressions), if any, used to give specific name to the container. | | command | `string` | `no` | The command, if any, to execute on the container | | ports | `map` | `no` | The container's port mappings, if any | | volumes | `map` | `no` | The container's volume mappings, if any | From 00cc01b0f3614132069113a482010bf70c06793e Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Bianchi Date: Fri, 10 Jan 2025 13:03:17 +0100 Subject: [PATCH 3/3] Update schema/workflow.yaml Signed-off-by: Jean-Baptiste Bianchi Co-authored-by: Charles d'Avernas --- schema/workflow.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schema/workflow.yaml b/schema/workflow.yaml index 198d804a..2d9b542d 100644 --- a/schema/workflow.yaml +++ b/schema/workflow.yaml @@ -625,7 +625,7 @@ $defs: name: type: string title: ContainerName - description: A runtime expression used to give specific name to the container, if any. + description: A runtime expression, if any, used to give specific name to the container. command: type: string title: ContainerCommand