Skip to content

Commit 4dbec5b

Browse files
authored
feat(serverless_jobs): enable secrets (#4255)
1 parent 44eaa1d commit 4dbec5b

11 files changed

+489
-3
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
2+
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
3+
Create a secret reference within a job definition.
4+
5+
USAGE:
6+
scw jobs secret create [arg=value ...]
7+
8+
ARGS:
9+
job-definition-id UUID of the job definition
10+
[secrets.{index}.secret-manager-id]
11+
[secrets.{index}.secret-manager-version]
12+
[secrets.{index}.path]
13+
[secrets.{index}.env-var-name]
14+
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw)
15+
16+
FLAGS:
17+
-h, --help help for create
18+
19+
GLOBAL FLAGS:
20+
-c, --config string The path to the config file
21+
-D, --debug Enable debug mode
22+
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
23+
-p, --profile string The config profile to use
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
2+
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
3+
Delete a secret reference within a job definition.
4+
5+
USAGE:
6+
scw jobs secret delete [arg=value ...]
7+
8+
ARGS:
9+
job-definition-id UUID of the job definition
10+
secret-id UUID of the secret reference within the job
11+
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw)
12+
13+
FLAGS:
14+
-h, --help help for delete
15+
16+
GLOBAL FLAGS:
17+
-c, --config string The path to the config file
18+
-D, --debug Enable debug mode
19+
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
20+
-p, --profile string The config profile to use
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
2+
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
3+
Get a secret references within a job definition.
4+
5+
USAGE:
6+
scw jobs secret get [arg=value ...]
7+
8+
ARGS:
9+
job-definition-id UUID of the job definition
10+
secret-id UUID of the secret reference within the job
11+
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw)
12+
13+
FLAGS:
14+
-h, --help help for get
15+
16+
GLOBAL FLAGS:
17+
-c, --config string The path to the config file
18+
-D, --debug Enable debug mode
19+
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
20+
-p, --profile string The config profile to use
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
2+
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
3+
List secrets references within a job definition.
4+
5+
USAGE:
6+
scw jobs secret list [arg=value ...]
7+
8+
ARGS:
9+
job-definition-id UUID of the job definition
10+
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw)
11+
12+
FLAGS:
13+
-h, --help help for list
14+
15+
GLOBAL FLAGS:
16+
-c, --config string The path to the config file
17+
-D, --debug Enable debug mode
18+
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
19+
-p, --profile string The config profile to use
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
2+
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
3+
Update a secret reference within a job definition.
4+
5+
USAGE:
6+
scw jobs secret update [arg=value ...]
7+
8+
ARGS:
9+
job-definition-id UUID of the job definition
10+
secret-id UUID of the secret reference within the job
11+
[secret-manager-version] Version of the secret in Secret Manager
12+
[path] Path of the secret to mount inside the job (either `path` or `env_var_name` must be set)
13+
[env-var-name] Environment variable name used to expose the secret inside the job (either `path` or `env_var_name` must be set)
14+
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw)
15+
16+
FLAGS:
17+
-h, --help help for update
18+
19+
GLOBAL FLAGS:
20+
-c, --config string The path to the config file
21+
-D, --debug Enable debug mode
22+
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
23+
-p, --profile string The config profile to use
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
2+
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
3+
USAGE:
4+
scw jobs secret <command>
5+
6+
AVAILABLE COMMANDS:
7+
create Create a secret reference within a job definition
8+
delete Delete a secret reference within a job definition
9+
get Get a secret references within a job definition
10+
list List secrets references within a job definition
11+
update Update a secret reference within a job definition
12+
13+
FLAGS:
14+
-h, --help help for secret
15+
16+
GLOBAL FLAGS:
17+
-c, --config string The path to the config file
18+
-D, --debug Enable debug mode
19+
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
20+
-p, --profile string The config profile to use
21+
22+
Use "scw jobs secret [command] --help" for more information about a command.

cmd/scw/testdata/test-all-usage-jobs-usage.golden

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ USAGE:
88
AVAILABLE COMMANDS:
99
definition
1010
run
11+
secret
1112

1213
FLAGS:
1314
-h, --help help for jobs

docs/commands/jobs.md

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ This API allows you to manage your Serverless Jobs.
1414
- [List all job runs with filters](#list-all-job-runs-with-filters)
1515
- [Stop a job run by its unique identifier](#stop-a-job-run-by-its-unique-identifier)
1616
- [Wait for a job run to reach a stable state](#wait-for-a-job-run-to-reach-a-stable-state)
17+
- [](#)
18+
- [Create a secret reference within a job definition](#create-a-secret-reference-within-a-job-definition)
19+
- [Delete a secret reference within a job definition](#delete-a-secret-reference-within-a-job-definition)
20+
- [Get a secret references within a job definition](#get-a-secret-references-within-a-job-definition)
21+
- [List secrets references within a job definition](#list-secrets-references-within-a-job-definition)
22+
- [Update a secret reference within a job definition](#update-a-secret-reference-within-a-job-definition)
1723

1824

1925
##
@@ -256,3 +262,118 @@ scw jobs run wait <job-run-id ...> [arg=value ...]
256262

257263

258264

265+
##
266+
267+
268+
269+
270+
### Create a secret reference within a job definition
271+
272+
Create a secret reference within a job definition.
273+
274+
**Usage:**
275+
276+
```
277+
scw jobs secret create [arg=value ...]
278+
```
279+
280+
281+
**Args:**
282+
283+
| Name | | Description |
284+
|------|---|-------------|
285+
| job-definition-id | Required | UUID of the job definition |
286+
| secrets.{index}.secret-manager-id | | |
287+
| secrets.{index}.secret-manager-version | | |
288+
| secrets.{index}.path | | |
289+
| secrets.{index}.env-var-name | | |
290+
| region | Default: `fr-par`<br />One of: `fr-par`, `nl-ams`, `pl-waw` | Region to target. If none is passed will use default region from the config |
291+
292+
293+
294+
### Delete a secret reference within a job definition
295+
296+
Delete a secret reference within a job definition.
297+
298+
**Usage:**
299+
300+
```
301+
scw jobs secret delete [arg=value ...]
302+
```
303+
304+
305+
**Args:**
306+
307+
| Name | | Description |
308+
|------|---|-------------|
309+
| job-definition-id | Required | UUID of the job definition |
310+
| secret-id | Required | UUID of the secret reference within the job |
311+
| region | Default: `fr-par`<br />One of: `fr-par`, `nl-ams`, `pl-waw` | Region to target. If none is passed will use default region from the config |
312+
313+
314+
315+
### Get a secret references within a job definition
316+
317+
Get a secret references within a job definition.
318+
319+
**Usage:**
320+
321+
```
322+
scw jobs secret get [arg=value ...]
323+
```
324+
325+
326+
**Args:**
327+
328+
| Name | | Description |
329+
|------|---|-------------|
330+
| job-definition-id | Required | UUID of the job definition |
331+
| secret-id | Required | UUID of the secret reference within the job |
332+
| region | Default: `fr-par`<br />One of: `fr-par`, `nl-ams`, `pl-waw` | Region to target. If none is passed will use default region from the config |
333+
334+
335+
336+
### List secrets references within a job definition
337+
338+
List secrets references within a job definition.
339+
340+
**Usage:**
341+
342+
```
343+
scw jobs secret list [arg=value ...]
344+
```
345+
346+
347+
**Args:**
348+
349+
| Name | | Description |
350+
|------|---|-------------|
351+
| job-definition-id | Required | UUID of the job definition |
352+
| region | Default: `fr-par`<br />One of: `fr-par`, `nl-ams`, `pl-waw` | Region to target. If none is passed will use default region from the config |
353+
354+
355+
356+
### Update a secret reference within a job definition
357+
358+
Update a secret reference within a job definition.
359+
360+
**Usage:**
361+
362+
```
363+
scw jobs secret update [arg=value ...]
364+
```
365+
366+
367+
**Args:**
368+
369+
| Name | | Description |
370+
|------|---|-------------|
371+
| job-definition-id | Required | UUID of the job definition |
372+
| secret-id | Required | UUID of the secret reference within the job |
373+
| secret-manager-version | | Version of the secret in Secret Manager |
374+
| path | | Path of the secret to mount inside the job (either `path` or `env_var_name` must be set) |
375+
| env-var-name | | Environment variable name used to expose the secret inside the job (either `path` or `env_var_name` must be set) |
376+
| region | Default: `fr-par`<br />One of: `fr-par`, `nl-ams`, `pl-waw` | Region to target. If none is passed will use default region from the config |
377+
378+
379+

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ require (
2626
github.com/mattn/go-isatty v0.0.20
2727
github.com/moby/buildkit v0.13.2
2828
github.com/opencontainers/go-digest v1.0.0
29-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241031163826-ea7169024163
29+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241104173714-b6b9e5455a0e
3030
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966
3131
github.com/spf13/cobra v1.8.1
3232
github.com/spf13/pflag v1.0.5

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -466,8 +466,8 @@ github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUz
466466
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
467467
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 h1:OkMGxebDjyw0ULyrTYWeN0UNCCkmCWfjPnIA2W6oviI=
468468
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06/go.mod h1:+ePHsJ1keEjQtpvf9HHw0f4ZeJ0TLRsxhunSI2hYJSs=
469-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241031163826-ea7169024163 h1:yO+2+sW3nnl8VIAvBXo0NJgUQRJpJkuG4MsMGoAGmW8=
470-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241031163826-ea7169024163/go.mod h1:3jrRJM7638J+P33hKy9MBvfOBxNo8pEGNQQoIv65Ihg=
469+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241104173714-b6b9e5455a0e h1:BKhmO3BK1mI9K1DFjLHxOa7dSETU2QWksMhfUAmfJLU=
470+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241104173714-b6b9e5455a0e/go.mod h1:3jrRJM7638J+P33hKy9MBvfOBxNo8pEGNQQoIv65Ihg=
471471
github.com/sclevine/spec v1.4.0 h1:z/Q9idDcay5m5irkZ28M7PtQM4aOISzOpj4bUPkDee8=
472472
github.com/sclevine/spec v1.4.0/go.mod h1:LvpgJaFyvQzRvc1kaDs0bulYwzC70PbiYjC4QnFHkOM=
473473
github.com/secure-systems-lab/go-securesystemslib v0.8.0 h1:mr5An6X45Kb2nddcFlbmfHkLguCE9laoZCUzEEpIZXA=

0 commit comments

Comments
 (0)