Skip to content

Commit 3d65144

Browse files
authored
Merge branch 'master' into v1.3614.0
2 parents edce4ca + e44ab83 commit 3d65144

18 files changed

Lines changed: 439 additions & 20 deletions

.github/workflows/coverage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
fetch-depth: 2
1515
- uses: actions/setup-go@v3
1616
with:
17-
go-version: '1.19'
17+
go-version: '1.20'
1818
- name: Run coverage
1919
run: go test -coverprofile=coverage.out -covermode=count ./...
2020
- name: Upload coverage to Codecov

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- name: Set up Go
2121
uses: actions/setup-go@v3
2222
with:
23-
go-version: 1.19
23+
go-version: 1.20
2424

2525
- name: Run GoReleaser
2626
uses: goreleaser/goreleaser-action@v4

.github/workflows/unit-tests.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
os-tests:
99
strategy:
1010
matrix:
11-
go-version: [1.19.x]
11+
go-version: [1.20.x]
1212
platform: [ubuntu-latest, macos-latest, windows-latest]
1313
runs-on: ${{ matrix.platform }}
1414
steps:
@@ -32,7 +32,7 @@ jobs:
3232
build-tests:
3333
strategy:
3434
matrix:
35-
go-version: [1.19.x]
35+
go-version: [1.20.x]
3636
platform: [ubuntu-latest]
3737
runs-on: ${{ matrix.platform }}
3838
steps:

.github/workflows/wasm.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
build-and-test:
99
strategy:
1010
matrix:
11-
go-version: [1.19.x]
11+
go-version: [1.20.x]
1212
platform: [ubuntu-latest]
1313
runs-on: ${{ matrix.platform }}
1414
steps:

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.19-alpine3.16 as builder
1+
FROM golang:1.20-alpine3.16 as builder
22

33
ENV BUILD_IN_DOCKER true
44
ARG VERSION
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+
This command validates the configuration of your Scaleway CLI tool.
4+
5+
It performs the following checks:
6+
7+
- YAML syntax correctness: It checks whether your config file is a valid YAML file.
8+
- Field validity: It checks whether the fields present in the config file are valid and expected fields. This includes fields like AccessKey, SecretKey, DefaultOrganizationID, DefaultProjectID, DefaultRegion, DefaultZone, and APIURL.
9+
- Field values: For each of the fields mentioned above, it checks whether the value assigned to it is valid. For example, it checks if the AccessKey and SecretKey are non-empty and meet the format expectations.
10+
11+
The command goes through each profile present in the config file and validates it.
12+
13+
USAGE:
14+
scw config validate
15+
16+
FLAGS:
17+
-h, --help help for validate
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

docs/commands/config.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ Read more about the config management engine at https://github.com/scaleway/scal
3737
- [Reset the config](#reset-the-config)
3838
- [Set a line from the config file](#set-a-line-from-the-config-file)
3939
- [Unset a line from the config file](#unset-a-line-from-the-config-file)
40+
- [Validate the config](#validate-the-config)
4041

4142

4243
## Destroy the config file
@@ -277,3 +278,33 @@ scw config unset <key ...> [arg=value ...]
277278

278279

279280

281+
## Validate the config
282+
283+
This command validates the configuration of your Scaleway CLI tool.
284+
285+
It performs the following checks:
286+
287+
- YAML syntax correctness: It checks whether your config file is a valid YAML file.
288+
- Field validity: It checks whether the fields present in the config file are valid and expected fields. This includes fields like AccessKey, SecretKey, DefaultOrganizationID, DefaultProjectID, DefaultRegion, DefaultZone, and APIURL.
289+
- Field values: For each of the fields mentioned above, it checks whether the value assigned to it is valid. For example, it checks if the AccessKey and SecretKey are non-empty and meet the format expectations.
290+
291+
The command goes through each profile present in the config file and validates it.
292+
293+
This command validates the configuration of your Scaleway CLI tool.
294+
295+
It performs the following checks:
296+
297+
- YAML syntax correctness: It checks whether your config file is a valid YAML file.
298+
- Field validity: It checks whether the fields present in the config file are valid and expected fields. This includes fields like AccessKey, SecretKey, DefaultOrganizationID, DefaultProjectID, DefaultRegion, DefaultZone, and APIURL.
299+
- Field values: For each of the fields mentioned above, it checks whether the value assigned to it is valid. For example, it checks if the AccessKey and SecretKey are non-empty and meet the format expectations.
300+
301+
The command goes through each profile present in the config file and validates it.
302+
303+
**Usage:**
304+
305+
```
306+
scw config validate
307+
```
308+
309+
310+

go.mod

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/scaleway/scaleway-cli/v2
22

3-
go 1.19
3+
go 1.20
44

55
// https://github.com/buildpacks/pack/pull/1735
66
replace github.com/buildpacks/pack => github.com/quantumsheep/pack v0.30.0-pre1.0.20230505095233-37158bb223a4
@@ -12,7 +12,7 @@ require (
1212
github.com/chzyer/readline v1.5.1
1313
github.com/containerd/console v1.0.3
1414
github.com/dnaeon/go-vcr v1.2.0
15-
github.com/docker/docker v23.0.6+incompatible
15+
github.com/docker/docker v24.0.2+incompatible
1616
github.com/dustin/go-humanize v1.0.1
1717
github.com/fatih/color v1.15.0
1818
github.com/getsentry/raven-go v0.2.0
@@ -22,14 +22,14 @@ require (
2222
github.com/karrick/tparse v2.4.2+incompatible
2323
github.com/kubernetes-client/go-base v0.0.0-20190205182333-3d0e39759d98
2424
github.com/mattn/go-colorable v0.1.13
25-
github.com/mattn/go-isatty v0.0.18
25+
github.com/mattn/go-isatty v0.0.19
2626
github.com/moby/buildkit v0.11.6
2727
github.com/opencontainers/go-digest v1.0.0
2828
github.com/pkg/errors v0.9.1
29-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.17.0.20230525084459-040bfc54c6de
29+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.17.0.20230526161530-cf508019231d
3030
github.com/spf13/cobra v1.7.0
3131
github.com/spf13/pflag v1.0.5
32-
github.com/stretchr/testify v1.8.2
32+
github.com/stretchr/testify v1.8.3
3333
golang.org/x/term v0.8.0
3434
golang.org/x/text v0.9.0
3535
gopkg.in/yaml.v3 v3.0.1

go.sum

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,8 @@ github.com/docker/cli v23.0.5+incompatible h1:ufWmAOuD3Vmr7JP2G5K3cyuNC4YZWiAsuD
208208
github.com/docker/cli v23.0.5+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8=
209209
github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m322EBzniBPB6ZIzuh8=
210210
github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
211-
github.com/docker/docker v23.0.6+incompatible h1:aBD4np894vatVX99UTx/GyOUOK4uEcROwA3+bQhEcoU=
212-
github.com/docker/docker v23.0.6+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
211+
github.com/docker/docker v24.0.2+incompatible h1:eATx+oLz9WdNVkQrr0qjQ8HvRJ4bOOxfzEo8R+dA3cg=
212+
github.com/docker/docker v24.0.2+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
213213
github.com/docker/docker-credential-helpers v0.7.0 h1:xtCHsjxogADNZcdv1pKUHXryefjlVRqWqIhk/uXJp0A=
214214
github.com/docker/docker-credential-helpers v0.7.0/go.mod h1:rETQfLdHNT3foU5kuNkFR1R1V12OJRRO5lzt2D1b5X0=
215215
github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ=
@@ -410,8 +410,8 @@ github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hd
410410
github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84=
411411
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
412412
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
413-
github.com/mattn/go-isatty v0.0.18 h1:DOKFKCQ7FNG2L1rbrmstDN4QVRdS89Nkh85u68Uwp98=
414-
github.com/mattn/go-isatty v0.0.18/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
413+
github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
414+
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
415415
github.com/mattn/go-runewidth v0.0.6/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
416416
github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
417417
github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
@@ -483,8 +483,8 @@ github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncj
483483
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
484484
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 h1:OkMGxebDjyw0ULyrTYWeN0UNCCkmCWfjPnIA2W6oviI=
485485
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06/go.mod h1:+ePHsJ1keEjQtpvf9HHw0f4ZeJ0TLRsxhunSI2hYJSs=
486-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.17.0.20230525084459-040bfc54c6de h1:CzBo3qxn06IUrXXa0aTU4uWqoKRw3CreELAXPZeTLG0=
487-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.17.0.20230525084459-040bfc54c6de/go.mod h1:fCa7OJZ/9DRTnOKmxvT6pn+LPWUptQAmHF/SBJUGEcg=
486+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.17.0.20230526161530-cf508019231d h1:qeI25+qrQ5MQaMFS2RgmAeAwUSWZSeYy5eYHnmW8vpk=
487+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.17.0.20230526161530-cf508019231d/go.mod h1:fCa7OJZ/9DRTnOKmxvT6pn+LPWUptQAmHF/SBJUGEcg=
488488
github.com/sclevine/spec v1.4.0 h1:z/Q9idDcay5m5irkZ28M7PtQM4aOISzOpj4bUPkDee8=
489489
github.com/secure-systems-lab/go-securesystemslib v0.4.0 h1:b23VGrQhTA8cN2CbBw7/FulN9fTtqYUdS5+Oxzt+DUE=
490490
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
@@ -520,8 +520,9 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
520520
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
521521
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
522522
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
523-
github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8=
524523
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
524+
github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY=
525+
github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
525526
github.com/tj/assert v0.0.0-20171129193455-018094318fb0/go.mod h1:mZ9/Rh9oLWpLLDRpvE+3b7gP/C2YyLFYxNmcLnPTMe0=
526527
github.com/tj/assert v0.0.3 h1:Df/BlaZ20mq6kuai7f5z2TvPFiwC3xaWJSDQNiIS3Rk=
527528
github.com/tj/assert v0.0.3/go.mod h1:Ne6X72Q+TB1AteidzQncjw9PabbMp4PBMZ1k+vd1Pvk=

internal/core/errors.go

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func InvalidSecretKeyError(value string) *CliError {
2626
func InvalidAccessKeyError(value string) *CliError {
2727
return &CliError{
2828
Err: fmt.Errorf("invalid access_key '%v'", value),
29-
Hint: "access_key should look like : SCWXXXXXXXXXXXXXXXXX.",
29+
Hint: "access_key should look like: SCWXXXXXXXXXXXXXXXXX.",
3030
}
3131
}
3232

@@ -44,6 +44,27 @@ func InvalidProjectIDError(value string) *CliError {
4444
}
4545
}
4646

47+
func InvalidRegionError(value string) *CliError {
48+
return &CliError{
49+
Err: fmt.Errorf("invalid region '%v'", value),
50+
Hint: "region format should look like: XX-XXX (e.g. fr-par).",
51+
}
52+
}
53+
54+
func InvalidZoneError(value string) *CliError {
55+
return &CliError{
56+
Err: fmt.Errorf("invalid zone '%v'", value),
57+
Hint: "zone format should look like XX-XXX-X: (e.g. fr-par-1).",
58+
}
59+
}
60+
61+
func InvalidAPIURLError(value string) *CliError {
62+
return &CliError{
63+
Err: fmt.Errorf("invalid api_url '%v'", value),
64+
Hint: "api_url should look like: https://www.example.com (e.g. https://api.scaleway.com).",
65+
}
66+
}
67+
4768
func ArgumentConflictError(arg1 string, arg2 string) *CliError {
4869
return &CliError{
4970
Err: fmt.Errorf("only one of those two arguments '%s' and '%s' can be specified in the same time", arg1, arg2),

0 commit comments

Comments
 (0)