Skip to content

Commit 1f4f33f

Browse files
SamyOubouazizLoic-kdjcirinosclwynerda-codesthomas-tacquet
authored
docs(srv): jobs commands and args MTA-6609 (#6000)
* docs(srv): jobs commands and args MTA-6609 * docs(srv): update * docs(srv): update * docs(srv): add link to api migration doc * docs(srv): correction * docs(srv): add note + deprecated and reference for startup command * docs(srv): typo correction * Apply suggestions from code review Co-authored-by: Jessica <113192637+jcirinosclwy@users.noreply.github.com> Co-authored-by: Néda <87707325+nerda-codes@users.noreply.github.com> * upgrade command and startup command * fixes * closer dates * changes in migration guide * changes in migration guide * fix broken links - typos and corrections --------- Co-authored-by: Loic KHAMDY <lkhamdy@scaleway.com> Co-authored-by: Jessica <113192637+jcirinosclwy@users.noreply.github.com> Co-authored-by: Néda <87707325+nerda-codes@users.noreply.github.com> Co-authored-by: Thomas Tacquet <thomas@tacquet.net>
1 parent af28170 commit 1f4f33f

File tree

6 files changed

+118
-8
lines changed

6 files changed

+118
-8
lines changed

pages/serverless-containers/concepts.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ The startup process steps are:
4848

4949
## Commands and arguments
5050

51-
Serverless Containers allows you to customize the `command` and `args` instructions of your container image directly from the [Scaleway console](https://console.scaleway.com) and from the [Scaleway API](https://www.scaleway.com/en/developers/api/serverless-containers/).
51+
Serverless Containers allows you to customize the `command` and `args` instructions of your container image directly from the [Scaleway console](https://console.scaleway.com) and via the [Scaleway API](https://www.scaleway.com/en/developers/api/serverless-containers/).
5252

5353
- The `command` instruction defines the command, process, or script executed when your container starts.
5454
- The `args` instruction defines the arguments passed to the `command` instruction. Arguments can be passed as environment variables, as shown in the example below.
@@ -109,7 +109,7 @@ Some names are reserved. [See details about reserved names](/serverless-containe
109109
110110
## Ephemeral storage
111111
112-
In addition to vCPU and RAM, Serverless Containers also provide a storage volume for the duration of the task. This storage space allows you to hold data during the life of the Servlerless Container instance and disappears once the execution is complete.
112+
In addition to vCPU and RAM, Serverless Containers also provide a storage volume for the duration of the task. This storage space allows you to hold data during the life of the Serverless Container instance and disappears once the execution is complete.
113113
114114
The maximum size of the ephemeral storage is tied to the allocated memory.
115115

pages/serverless-jobs/concepts.mdx

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ dates:
88
---
99
import ServerlessConcepts from '@macros/serverless/serverless-concepts.mdx'
1010

11+
## Commands and arguments
12+
13+
The field `command` is deprecated in favor of `startup_command` in `v1alpha2`.
14+
15+
For more details see [startup command and arguments](/serverless-jobs/concepts/#startup-commands-and-arguments) and [v1alpha2 migration guide](/serverless-jobs/reference-content/v1alpha1-to-v1alpha2/).
16+
1117
## Container Registry
1218

1319
Container Registry is the place where your images are stored before being deployed. We recommend using Scaleway Container Registry for optimal integration. See the [migration guide](/serverless-jobs/api-cli/migrate-external-image-to-scaleway-registry/) for full details.
@@ -68,13 +74,35 @@ For more details about advantages of using Serverless, [read the Serverless over
6874

6975
A secret reference is a mechanism that allows you to use a secret stored in [Secret Manager](/secret-manager/) within Serverless Jobs. It allows you to securely reference sensitive data, such as API secret keys, passwords, tokens, or certificates.
7076

71-
## Startup command
77+
## Startup commands and arguments
78+
79+
Serverless Jobs allows you to customize the `startup_command` and `args` instructions to override default image instructions.
80+
81+
<Message type="note">
82+
* The field `command` is deprecated in favor of `startup_command`.
83+
* If `startup_command` is already filled then the `command` instruction is ignored.
84+
* `startup_command` and `args` can interpret environment variables, allowing for easier automations.
85+
</Message>
86+
87+
- The `startup_command` instruction defines the command, process, or script executed when your job starts. It overrides the `ENTRYPOINT` of the image.
88+
- The `args` instruction defines the arguments passed to the `startup_command` instruction. Arguments can be passed as environment variables, as shown in the example below.
89+
90+
**Example:**
91+
92+
```yaml
93+
env:
94+
- name: MESSAGE
95+
value: "hello world"
96+
startup_command: ["/bin/echo"]
97+
args: ["$(MESSAGE)"]
98+
```
7299
73-
This optional field allows you to specify a custom command executed upon starting your job if your container image does not have one already, or if you use a public container image.
100+
Refer to the [official Kubernetes documentation](https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/) for more information on commands and arguments behavior.
74101
75102
## Status
76103
77104
A Serverless Job run can have the following statuses:
105+
* **Running**: your Serverless Job run is currently executing.
78106
* **Succeeded**: your Serverless Job run finished in a successful state.
79107
* **Queued**: your Serverless Job run is waiting for resources to run.
80108
* **Error**: your Serverless Job run finished with an error or timeout. [Check our troubleshooting documentation](/serverless-jobs/troubleshooting/job-in-error-state/) to solve the issue.
@@ -90,7 +118,7 @@ To store data you can use [Scaleway Object Storage](/object-storage/), [Scaleway
90118
91119
## Terraform/OpenTofu
92120
93-
Terraform/OpenTofu is an infrastructure-as-code tool, owned by Hashicorp. Serverless Jobs integrate easily with your infrastructure as code, via our [Terraform/OpenTofu provider and resources](https://registry.terraform.io/providers/scaleway/scaleway/latest/docs/resources/job_definition).
121+
Terraform is an infrastructure-as-code tool developed by HashiCorp, while OpenTofu is an open-source fork of Terraform. Serverless Jobs integrate easily with your infrastructure as code, via our [Terraform/OpenTofu provider and resources](https://registry.terraform.io/providers/scaleway/scaleway/latest/docs/resources/job_definition).
94122
95123
Examples using Terraform/OpenTofu can be found in our [Serverless Examples repository](https://github.com/scaleway/serverless-examples), such as our [example using Terraform/OpenTofu with Serverless Jobs](https://github.com/scaleway/serverless-examples/blob/main/jobs/terraform-hello-world).
96124

pages/serverless-jobs/how-to/create-job.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ Scaleway's Serverless Jobs allows you to create jobs from several container [reg
5858
- Customize the ephemeral storage for your job according to your requirements. The data stored in your job is not retained once it is finished.
5959
</TabsTab>
6060
<TabsTab label="Execution">
61-
1. Add a **startup command** to your job. It will be executed every time your job is run.
61+
1. Add [commands and arguments](/serverless-jobs/concepts/#commands-and-arguments) to your job. They will be executed every time your job is run.
6262
2. Set a **maximum duration** to your job to stop it automatically if it does not complete within this limit.
6363
</TabsTab>
6464
</Tabs>
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
---
2+
title: How to migrate from command to startup command and arguments
3+
description: Learn how to migrate from the legacy command system to the modern startup command and arguments for Scaleway Serverless Jobs.
4+
tags: containers
5+
dates:
6+
validation: 2026-02-24
7+
posted: 2025-02-24
8+
---
9+
10+
import Requirements from '@macros/iam/requirements.mdx'
11+
12+
The Serverless Jobs `v1alpha2` API introduces a new startup execution mechanism based on [commands and arguments](/serverless-jobs/concepts/#startup-commands-and-arguments), replacing the legacy `command`.
13+
14+
The Scaleway console allows you to quickly and easily migrate your existing jobs to the new system.
15+
16+
Migration from `command` field to `startup_command` field is mostly transparent for customers using Scaleway Console but can require some attention of API, CLI and other devtools users.
17+
18+
The change allows for:
19+
- More customization for executing complex commands, by separating `startup_command` and `args`.
20+
- Better alignment with our underlying [Kubernetes implementation](https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/).
21+
- The ability to compute environment variables used in command and argument strings.
22+
- `startup_command` is now an array of commands instead of a single string.
23+
24+
<Requirements />
25+
26+
- A Scaleway account logged into the [console](https://console.scaleway.com)
27+
- [Owner](/iam/concepts/#owner) status or [IAM permissions](/iam/concepts/#permission) allowing you to perform actions in the intended Organization
28+
- An existing job that uses the legacy command field
29+
30+
## How to migrate from command to startup commands and arguments
31+
32+
1. Click **Jobs** in the **Serverless** section of the side menu. The jobs page displays.
33+
34+
2. Click the name of the job you want to manage, then click the **Settings** tab.
35+
36+
3. Scroll down to the **Configure advanced options**, then click the **Execution** tab.
37+
38+
4. Click the **Upgrade** button. A pop-up displays.
39+
40+
5. Split your existing startup command into a command (which corresponds to the `ENTRYPOINT` Docker instruction), and arguments (which correspond to the `CMD` Docker instruction).
41+
42+
6. Click **Upgrade to the new format** to finish.
43+
44+
Your Serverless Job now uses the command and arguments mechanism.
45+
46+
## Migration examples
47+
48+
### Simple command
49+
50+
**Legacy command**
51+
52+
```bash
53+
sleep 60s
54+
```
55+
56+
**Corresponding command and arguments**
57+
58+
```yaml
59+
startup_command: [sleep]
60+
args: [60s]
61+
```
62+
63+
### Complex command
64+
65+
**Legacy command**
66+
67+
```bash
68+
/app/migrate up --database "$DB_URL" --password "$DB_PASSWORD" --port 3002
69+
```
70+
71+
**Corresponding command and arguments**
72+
73+
```yaml
74+
startup_command: [/app/migrate]
75+
args: [up, --database, "$(DB_URL)", --password, "$(DB_PASSWORD)", --port, 3002]
76+
```

pages/serverless-jobs/menu.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ export const serverlessJobsMenu = {
5858
label: 'Configure alerts for a job',
5959
slug: 'configure-alerts-jobs',
6060
},
61+
{
62+
label: 'Migrate from command to startup command and arguments',
63+
slug: 'migrate-command-to-startup-command',
64+
},
6165
{
6266
label: 'Delete a job',
6367
slug: 'delete-job',

pages/serverless-jobs/reference-content/v1alpha1-to-v1alpha2.mdx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ It is replaced by two new fields, designed to give you more control and align wi
2828

2929
This separation allows for a cleaner definition of entry points and arguments, mirroring standard container practices.
3030

31+
Refer to the [dedicated documentation](/serverless-jobs/how-to/migrate-command-to-startup-command/) for more information on how to migrate from the legacy **command** to **startup command and arguments**.
32+
3133
### Job run troubleshooting
3234

3335
To assist with debugging, `v1alpha2` adds a **Job Run Reason** field.
@@ -42,7 +44,7 @@ If you currently use `v1alpha1` in your automation tools, we recommend updating
4244

4345
Ensure you update your [Scaleway Provider](/terraform/quickstart/) or [Scaleway CLI](/scaleway-cli/quickstart/) to the latest version to access `v1alpha2` fields.
4446

45-
When defining Jobs, replace the deprecated `command` field with the new structure.
47+
When defining Jobs, replace the deprecated `startup_command` field with the new structure.
4648

4749
**Example configuration (Terraform-style pseudocode):**
4850

@@ -55,5 +57,5 @@ resource "scaleway_job_definition" "main" {
5557
# New (v1alpha2)
5658
resource "scaleway_job_definition" "main" {
5759
startup_command = ["python"]
58-
args = ["app.py", "--verbose"]
60+
args = ["app.py", "--verbose"]
5961
}

0 commit comments

Comments
 (0)