Skip to content

Commit 633a7ab

Browse files
authored
feat(cli): rename trivy auth to trivy registry (#7727)
Signed-off-by: knqyf263 <knqyf263@gmail.com>
1 parent 31aa20a commit 633a7ab

File tree

10 files changed

+31
-31
lines changed

10 files changed

+31
-31
lines changed

contrib/Trivy.gitlab-ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Trivy_container_scanning:
1414
- apk add --no-cache curl docker-cli
1515
- curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin ${TRIVY_VERSION}
1616
- curl -sSL -o /tmp/trivy-gitlab.tpl https://github.com/aquasecurity/trivy/raw/${TRIVY_VERSION}/contrib/gitlab.tpl
17-
- trivy auth login --username "$CI_REGISTRY_USER" --password "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
17+
- trivy registry login --username "$CI_REGISTRY_USER" --password "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
1818
script:
1919
- trivy --exit-code 0 --cache-dir .trivycache/ --no-progress --format template --template "@/tmp/trivy-gitlab.tpl" -o gl-container-scanning-report.json $IMAGE
2020
cache:

docs/docs/advanced/private-registries/index.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ Trivy can download images from a private registry without the need for installin
22
This makes it easy to run within a CI process.
33

44
## Login
5-
You can log in to a private registry using the `trivy auth login` command.
5+
You can log in to a private registry using the `trivy registry login` command.
66
It uses the Docker configuration file (`~/.docker/config.json`) to store the credentials under the hood, and the configuration file path can be configured by `DOCKER_CONFIG` environment variable.
77

88
```shell
9-
$ cat ~/my_password.txt | trivy auth login --username foo --password-stdin ghcr.io
9+
$ cat ~/my_password.txt | trivy registry login --username foo --password-stdin ghcr.io
1010
$ trivy image ghcr.io/your/private_image
1111
```
1212

@@ -23,7 +23,7 @@ $ TRIVY_USERNAME=YOUR_USERNAME TRIVY_PASSWORD=YOUR_PASSWORD trivy image YOUR_PRI
2323
To mitigate this risk:
2424

2525
1. Set credentials cautiously and only when necessary.
26-
2. Prefer using `trivy auth config` to pre-configure credentials with specific registries, which ensures credentials are only sent to appropriate registries.
26+
2. Prefer using `trivy registry login` to pre-configure credentials with specific registries, which ensures credentials are only sent to appropriate registries.
2727

2828
Trivy also supports providing credentials through CLI flags:
2929

docs/docs/references/configuration/cli/trivy.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ trivy [global flags] command [flags] target
4343

4444
### SEE ALSO
4545

46-
* [trivy auth](trivy_auth.md) - Authentication
4746
* [trivy clean](trivy_clean.md) - Remove cached files
4847
* [trivy config](trivy_config.md) - Scan config files for misconfigurations
4948
* [trivy convert](trivy_convert.md) - Convert Trivy JSON report into a different format
@@ -52,6 +51,7 @@ trivy [global flags] command [flags] target
5251
* [trivy kubernetes](trivy_kubernetes.md) - [EXPERIMENTAL] Scan kubernetes cluster
5352
* [trivy module](trivy_module.md) - Manage modules
5453
* [trivy plugin](trivy_plugin.md) - Manage plugins
54+
* [trivy registry](trivy_registry.md) - Manage registry authentication
5555
* [trivy repository](trivy_repository.md) - Scan a repository
5656
* [trivy rootfs](trivy_rootfs.md) - Scan rootfs
5757
* [trivy sbom](trivy_sbom.md) - Scan SBOM for vulnerabilities and licenses

docs/docs/references/configuration/cli/trivy_auth.md docs/docs/references/configuration/cli/trivy_registry.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
## trivy auth
1+
## trivy registry
22

3-
Authentication
3+
Manage registry authentication
44

55
### Options
66

77
```
8-
-h, --help help for auth
8+
-h, --help help for registry
99
```
1010

1111
### Options inherited from parent commands
@@ -24,6 +24,6 @@ Authentication
2424
### SEE ALSO
2525

2626
* [trivy](trivy.md) - Unified security scanner
27-
* [trivy auth login](trivy_auth_login.md) - Log in to a registry
28-
* [trivy auth logout](trivy_auth_logout.md) - Log out of a registry
27+
* [trivy registry login](trivy_registry_login.md) - Log in to a registry
28+
* [trivy registry logout](trivy_registry_logout.md) - Log out of a registry
2929

docs/docs/references/configuration/cli/trivy_auth_login.md docs/docs/references/configuration/cli/trivy_registry_login.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
## trivy auth login
1+
## trivy registry login
22

33
Log in to a registry
44

55
```
6-
trivy auth login SERVER [flags]
6+
trivy registry login SERVER [flags]
77
```
88

99
### Examples
1010

1111
```
1212
# Log in to reg.example.com
13-
cat ~/my_password.txt | trivy auth login --username foo --password-stdin reg.example.com
13+
cat ~/my_password.txt | trivy registry login --username foo --password-stdin reg.example.com
1414
```
1515

1616
### Options
@@ -37,5 +37,5 @@ trivy auth login SERVER [flags]
3737

3838
### SEE ALSO
3939

40-
* [trivy auth](trivy_auth.md) - Authentication
40+
* [trivy registry](trivy_registry.md) - Manage registry authentication
4141

docs/docs/references/configuration/cli/trivy_auth_logout.md docs/docs/references/configuration/cli/trivy_registry_logout.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
## trivy auth logout
1+
## trivy registry logout
22

33
Log out of a registry
44

55
```
6-
trivy auth logout SERVER [flags]
6+
trivy registry logout SERVER [flags]
77
```
88

99
### Examples
1010

1111
```
1212
# Log out of reg.example.com
13-
trivy auth logout reg.example.com
13+
trivy registry logout reg.example.com
1414
```
1515

1616
### Options
@@ -34,5 +34,5 @@ trivy auth logout SERVER [flags]
3434

3535
### SEE ALSO
3636

37-
* [trivy auth](trivy_auth.md) - Authentication
37+
* [trivy registry](trivy_registry.md) - Manage registry authentication
3838

docs/docs/target/container_image.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ Trivy supports registries that comply with the following specifications.
297297
- [Docker Registry HTTP API V2](https://docs.docker.com/registry/spec/api/)
298298
- [OCI Distribution Specification](https://github.com/opencontainers/distribution-spec)
299299

300-
You can configure credentials with `trivy auth login`.
300+
You can configure credentials with `trivy registry login`.
301301
See [here](../advanced/private-registries/index.md) for the detail.
302302

303303
### Tar Files

integration/registry_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ func TestRegistry(t *testing.T) {
184184
golden: "testdata/alpine-310.json.golden",
185185
},
186186
{
187-
name: "authenticate with 'trivy auth login'",
187+
name: "authenticate with 'trivy registry login'",
188188
imageName: "alpine:3.10",
189189
imageFile: "testdata/fixtures/images/alpine-310.tar.gz",
190190
os: "alpine 3.10.2",
@@ -295,7 +295,7 @@ func setupEnv(t *testing.T, imageRef name.Reference, baseDir string, opt registr
295295
case opt.AuthLogin:
296296
t.Setenv("DOCKER_CONFIG", t.TempDir())
297297
err := execute([]string{
298-
"auth",
298+
"registry",
299299
"login",
300300
"--username",
301301
opt.Username,

mkdocs.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,6 @@ nav:
158158
- Configuration:
159159
- CLI:
160160
- Overview: docs/references/configuration/cli/trivy.md
161-
- Auth:
162-
- Auth: docs/references/configuration/cli/trivy_auth.md
163-
- Auth Login: docs/references/configuration/cli/trivy_auth_login.md
164-
- Auth Logout: docs/references/configuration/cli/trivy_auth_logout.md
165161
- Clean: docs/references/configuration/cli/trivy_clean.md
166162
- Config: docs/references/configuration/cli/trivy_config.md
167163
- Convert: docs/references/configuration/cli/trivy_convert.md
@@ -182,6 +178,10 @@ nav:
182178
- Plugin Update: docs/references/configuration/cli/trivy_plugin_update.md
183179
- Plugin Upgrade: docs/references/configuration/cli/trivy_plugin_upgrade.md
184180
- Plugin Search: docs/references/configuration/cli/trivy_plugin_search.md
181+
- Registry:
182+
- Registry: docs/references/configuration/cli/trivy_registry.md
183+
- Registry Login: docs/references/configuration/cli/trivy_registry_login.md
184+
- Registry Logout: docs/references/configuration/cli/trivy_registry_logout.md
185185
- Repository: docs/references/configuration/cli/trivy_repository.md
186186
- Rootfs: docs/references/configuration/cli/trivy_rootfs.md
187187
- SBOM: docs/references/configuration/cli/trivy_sbom.md

pkg/commands/app.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ func NewApp() *cobra.Command {
100100
NewVersionCommand(globalFlags),
101101
NewVMCommand(globalFlags),
102102
NewCleanCommand(globalFlags),
103-
NewAuthCommand(globalFlags),
103+
NewRegistryCommand(globalFlags),
104104
NewVEXCommand(globalFlags),
105105
)
106106

@@ -1235,11 +1235,11 @@ func NewCleanCommand(globalFlags *flag.GlobalFlagGroup) *cobra.Command {
12351235
return cmd
12361236
}
12371237

1238-
func NewAuthCommand(globalFlags *flag.GlobalFlagGroup) *cobra.Command {
1238+
func NewRegistryCommand(globalFlags *flag.GlobalFlagGroup) *cobra.Command {
12391239
cmd := &cobra.Command{
1240-
Use: "auth [flags]",
1240+
Use: "registry [flags]",
12411241
GroupID: groupUtility,
1242-
Short: "Authentication",
1242+
Short: "Manage registry authentication",
12431243
SilenceErrors: true,
12441244
SilenceUsage: true,
12451245
}
@@ -1255,7 +1255,7 @@ func NewAuthCommand(globalFlags *flag.GlobalFlagGroup) *cobra.Command {
12551255
SilenceErrors: true,
12561256
SilenceUsage: true,
12571257
Example: ` # Log in to reg.example.com
1258-
cat ~/my_password.txt | trivy auth login --username foo --password-stdin reg.example.com`,
1258+
cat ~/my_password.txt | trivy registry login --username foo --password-stdin reg.example.com`,
12591259
Args: cobra.ExactArgs(1),
12601260
PreRunE: func(cmd *cobra.Command, args []string) error {
12611261
if err := loginFlags.Bind(cmd); err != nil {
@@ -1277,7 +1277,7 @@ func NewAuthCommand(globalFlags *flag.GlobalFlagGroup) *cobra.Command {
12771277
SilenceErrors: true,
12781278
SilenceUsage: true,
12791279
Example: ` # Log out of reg.example.com
1280-
trivy auth logout reg.example.com`,
1280+
trivy registry logout reg.example.com`,
12811281
Args: cobra.ExactArgs(1),
12821282
RunE: func(cmd *cobra.Command, args []string) error {
12831283
return auth.Logout(cmd.Context(), args[0])

0 commit comments

Comments
 (0)