You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -27,6 +27,9 @@ You can bypass this limitation by passing complex commands and scripts to a Serv
27
27
3. Click **+ Create secret**.
28
28
29
29
4. Select **Import secret**, choose the **Opaque** secret type, then drag and drop your file to the dedicated area. The maximum file size for your secret is 64 KiB.
30
+
<Messagetype="note">
31
+
We recommend using a shell script (`.sh`) file containing your command. Refer to the [section below](#complex-commands-examples) for example commands.
32
+
</Message>
30
33
31
34
5. Choose the **Scaleway-managed encryption key**, as it requires no configuration on your side.
32
35
@@ -38,4 +41,74 @@ You can bypass this limitation by passing complex commands and scripts to a Serv
38
41
39
42
Your file can now be passed to your Serverless Job as a secret reference.
40
43
41
-
##
44
+
## Create a Serverles Job referencing your command as a secret
45
+
46
+
1. Click **Jobs** in the **Serverless** section of the side menu. The jobs page displays.
47
+
48
+
2. Click **Create job**. The job creation wizard displays.
49
+
50
+
3. Select the **external** container registry.
51
+
52
+
4. Enter the following image URL:
53
+
```sh
54
+
scaleway/cli:latest
55
+
```
56
+
57
+
5. Enter a name, select the desired region, and choose the smallest **resources** available.
58
+
59
+
6. Enter a CRON schedule to run your job periodically. Refer to the [dedicated documentation](/serverless-jobs/reference-content/cron-schedules/) on CRON schedules.
60
+
61
+
7. Add your command file as a [secrets reference](/serverless-functions/concepts/#secrets). Refer to the [dedicated documentation] on secrets for more information.
62
+
63
+
8. Add the following startup command to call your file:
64
+
```sh
65
+
bash /complex_command.sh start
66
+
```
67
+
68
+
9. Click **Create job** to finish.
69
+
70
+
You job is now ready to run at the specified schedule.
71
+
72
+
## Complex commands examples
73
+
74
+
Below are examples of commands that must be passed via a secret referenced as a file in Serverless Jobs. You can find more complex commands examples on the [Scaleway CLI repository](/https://github.com/scaleway/scaleway-cli/blob/master/docs/cookbook.md).
75
+
76
+
**Retrieve a specific field from the output using jq**
77
+
78
+
```bash
79
+
## Retrieve all available instance type names
80
+
81
+
# Using jq
82
+
scw -o json instance server-type list | jq -r '.[].name'
83
+
# Using CLI templates
84
+
scw instance server-type list -o template="{{ .Name }}"
0 commit comments