Skip to content

Commit c73033e

Browse files
upgrade command and startup command
1 parent f38cbc5 commit c73033e

File tree

2 files changed

+41
-31
lines changed

2 files changed

+41
-31
lines changed

pages/serverless-jobs/concepts.mdx

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,9 @@ import ServerlessConcepts from '@macros/serverless/serverless-concepts.mdx'
1010

1111
## Commands and arguments
1212

13-
Serverless Jobs 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-jobs/).
13+
Field `command` is deprecated prior `startup_command` in `v1alpha2`.
1414

15-
<Message type="note">
16-
If `startup_command` is already filled then the `command` instruction is ignored.
17-
</Message>
18-
19-
- The `command` instruction defines the command, process, or script executed when your job starts.
20-
- The `args` instruction defines the arguments passed to the `command` instruction. Arguments can be passed as environment variables, as shown in the example below.
21-
22-
**Example**
23-
24-
```yaml
25-
env:
26-
- name: MESSAGE
27-
value: "hello world"
28-
command: ["/bin/echo"]
29-
args: ["$(MESSAGE)"]
30-
```
31-
32-
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.
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/).
3316

3417
## Container Registry
3518

@@ -91,9 +74,30 @@ For more details about advantages of using Serverless, [read the Serverless over
9174

9275
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.
9376

94-
## 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.
9580

96-
Deprecated and replaced by [Commands and arguments](#commands-and-arguments).
81+
<Message type="note">
82+
* `command` field is deprecated prior `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+
```
99+
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.
97101
98102
## Status
99103

pages/serverless-jobs/how-to/migrate-startup-command-to-command-args.mdx renamed to pages/serverless-jobs/how-to/migrate-command-to-startup-command.mdx

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,25 @@ dates:
99

1010
import Requirements from '@macros/iam/requirements.mdx'
1111

12-
The Serverless Jobs `v1alpha2` API introduces a new startup execution mechanism based on [commands and arguments](/serverless-containers/concepts/#commands-and-arguments), replacing the legacy startup command.
12+
The Serverless Jobs `v1alpha2` API introduces a new startup execution mechanism based on [commands and arguments](/serverless-containers/concepts/#startup-command-and-arguments), replacing the legacy `command`.
1313

1414
The Scaleway console allows you to quickly and easily migrate your existing jobs to the new system.
1515

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 customisation for executing complex command, by separating `startup_command` and `args`.
20+
- To match our underlying [Kubernetes implementation](https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/).
21+
- It allows 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+
1624
<Requirements />
1725

1826
- A Scaleway account logged into the [console](https://console.scaleway.com)
1927
- [Owner](/iam/concepts/#owner) status or [IAM permissions](/iam/concepts/#permission) allowing you to perform actions in the intended Organization
2028
- An existing job that uses a startup command
2129

22-
## How to migrate from startup command to commands and arguments
30+
## How to migrate from command to startup commands and arguments
2331

2432
1. Click **Jobs** in the **Serverless** section of the side menu. The jobs page displays.
2533

@@ -39,7 +47,7 @@ Your Serverless Job now uses the command and arguments mechanism.
3947

4048
### Simple command
4149

42-
**Legacy startup command**
50+
**Legacy command**
4351

4452
```bash
4553
sleep 60s
@@ -48,13 +56,13 @@ sleep 60s
4856
**Corresponding command and arguments**
4957

5058
```yaml
51-
command: [sleep]
59+
startup_command: [sleep]
5260
args: [60s]
5361
```
5462
5563
### Complex command
5664
57-
**Legacy startup command**
65+
**Legacy command**
5866
5967
```bash
6068
/app/migrate up --database "$DB_URL" --password "$DB_PASSWORD" --port 3002
@@ -63,8 +71,6 @@ args: [60s]
6371
**Corresponding command and arguments**
6472

6573
```yaml
66-
command: [/app/migrate]
67-
args: [up, --database, "$(DB_URL)", --password, "$(DB_PASSWORD)", --port, 3002]
68-
```
69-
70-
Refer to the [official Kubernetes documentation](https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/) for more information on command and arguments behavior and syntax.
74+
startup_command: [/app/migrate]
75+
args: [up, --database, "$(DB_URL)", --password, "$(DB_PASSWORD)", --port, 3002]
76+
```

0 commit comments

Comments
 (0)