diff --git a/pages/serverless-jobs/concepts.mdx b/pages/serverless-jobs/concepts.mdx index 269b33a44a..814d4ca9ea 100644 --- a/pages/serverless-jobs/concepts.mdx +++ b/pages/serverless-jobs/concepts.mdx @@ -8,6 +8,25 @@ dates: --- import ServerlessConcepts from '@macros/serverless/serverless-concepts.mdx' +## Commands and arguments + +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 from the [Scaleway API](https://www.scaleway.com/en/developers/api/serverless-jobs/). + +- The `command` instruction defines the command, process, or script executed when your job starts. +- The `args` instruction defines the arguments passed to the `command` instruction. Arguments can be passed as environment variables, as shown in the example below. + +**Example** + +```yaml +env: +- name: MESSAGE + value: "hello world" +command: ["/bin/echo"] +args: ["$(MESSAGE)"] +``` + +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. + ## Container Registry 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. diff --git a/pages/serverless-jobs/how-to/create-job.mdx b/pages/serverless-jobs/how-to/create-job.mdx index 9c0bfb0f14..720086fcbd 100644 --- a/pages/serverless-jobs/how-to/create-job.mdx +++ b/pages/serverless-jobs/how-to/create-job.mdx @@ -58,7 +58,7 @@ Scaleway's Serverless Jobs allows you to create jobs from several container [reg - Customize the ephemeral storage for your job according to your requirements. The data stored in your job is not retained once it is finished. - 1. Add a **startup command** to your job. It will be executed every time your job is run. + 1. Add [commands and arguments](/serverless-jobs/concepts/#commands-and-arguments) to your job. they will be executed every time your job is run. 2. Set a **maximum duration** to your job to stop it automatically if it does not complete within this limit. diff --git a/pages/serverless-jobs/how-to/migrate-startup-command-to-command-args.mdx b/pages/serverless-jobs/how-to/migrate-startup-command-to-command-args.mdx new file mode 100644 index 0000000000..00a80ecc06 --- /dev/null +++ b/pages/serverless-jobs/how-to/migrate-startup-command-to-command-args.mdx @@ -0,0 +1,70 @@ +--- +title: How to migrate from startup command to command and arguments +description: How to migrate from the legacy startup command system to the modern commands and arguments for Scaleway Serverless Jobs. +tags: containers +dates: + validation: 2025-12-23 + posted: 2025-12-23 +--- + +import Requirements from '@macros/iam/requirements.mdx' + +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. + +The Scaleway console allows you to quickly and easily migrate your existing jobs to the new system. + + + +- A Scaleway account logged into the [console](https://console.scaleway.com) +- [Owner](/iam/concepts/#owner) status or [IAM permissions](/iam/concepts/#permission) allowing you to perform actions in the intended Organization +- An existing job that uses a startup command + +## How to migrate from startup command to commands and arguments + +1. Click **Jobs** in the **Serverless** section of the side menu. The jobs page displays. + +2. Click the name of the job you want to manage, then click the **Settings** tab. + +3. Scroll down to the **Configure advanced options**, then click the **Execution** tab. + +4. Click the **Upgrade** button. A pop-up displays. + +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). + +6. Click **Upgrade to the new format** to finish. + +Your Serverless Job now uses the command and arguments mechanism. + +## Migration examples + +### Simple command + +**Legacy startup command** + +```bash +sleep 60s +``` + +**Corresponding command and arguments** + +```yaml +command: [sleep] +args: [60s] +``` + +### Complex command + +**Legacy startup command** + +```bash +/app/migrate up --database "$DB_URL" --password "$DB_PASSWORD" --port 3002 +``` + +**Corresponding command and arguments** + +```yaml + command: [/app/migrate] + args: [up, --database, "$(DB_URL)", --password, "$(DB_PASSWORD)", --port, 3002] +``` + +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. \ No newline at end of file diff --git a/pages/serverless-jobs/menu.ts b/pages/serverless-jobs/menu.ts index d373030045..974ec07a22 100644 --- a/pages/serverless-jobs/menu.ts +++ b/pages/serverless-jobs/menu.ts @@ -58,6 +58,10 @@ export const serverlessJobsMenu = { label: 'Configure alerts for a job', slug: 'configure-alerts-jobs', }, + { + label: 'Migrate from startup command to command and arguments', + slug: 'migrate-startup-command-to-command-args', + }, { label: 'Delete a job', slug: 'delete-job', diff --git a/pages/serverless-jobs/reference-content/v1alpha1-to-v1alpha2.mdx b/pages/serverless-jobs/reference-content/v1alpha1-to-v1alpha2.mdx index 1c240a691c..c121c472fe 100644 --- a/pages/serverless-jobs/reference-content/v1alpha1-to-v1alpha2.mdx +++ b/pages/serverless-jobs/reference-content/v1alpha1-to-v1alpha2.mdx @@ -19,15 +19,17 @@ We recommend using `v1alpha2` for all new integrations via the API, SDK, Terrafo ### Job definition command -In `v1alpha2`, the `command` field for Job definitions is **deprecated**. +In `v1alpha2`, the `startup_command` field for Job definitions is **deprecated**. It is replaced by two new fields, designed to give you more control and align with the [Serverless Containers](/serverless-containers/concepts/#serverless-containers) experience: -* **`startup_command`**: A list of commands to start the application. +* **`command`**: A list of commands to start the application. * **`args`**: A list of arguments passed to the startup command. This separation allows for a cleaner definition of entry points and arguments, mirroring standard container practices. +Refer to the [dedicated documentation](/serverless-jobs/how-to/migrate-startup-command-to-command-args/) for more information on how to migrate from the legacy **startup command** to **command and arguments**. + ### Job run troubleshooting To assist with debugging, `v1alpha2` adds a **Job Run Reason** field.