mirror of
https://github.com/docker/cli.git
synced 2026-01-26 15:41:42 +03:00
move the `trust` subcommands to a plugin, so that the subcommands can
be installed separate from the `docker trust` integration in push/pull
(for situations where trust verification happens on the daemon side).
make binary
go build -o /usr/libexec/docker/cli-plugins/docker-trust ./cmd/docker-trust
docker info
Client:
Version: 28.2.0-dev
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: v0.24.0
Path: /usr/libexec/docker/cli-plugins/docker-buildx
trust: Manage trust on Docker images (Docker Inc.)
Version: unknown-version
Path: /usr/libexec/docker/cli-plugins/docker-trust
docker trust --help
Usage: docker trust [OPTIONS] COMMAND
Extended build capabilities with BuildKit
Options:
-D, --debug Enable debug logging
Management Commands:
key Manage keys for signing Docker images
signer Manage entities who can sign Docker images
Commands:
inspect Return low-level information about keys and signatures
revoke Remove trust for an image
sign Sign an image
Run 'docker trust COMMAND --help' for more information on a command.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
34 lines
947 B
Go
34 lines
947 B
Go
package trust
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/docker/cli/cmd/docker-trust/internal/trust"
|
|
"github.com/theupdateframework/notary/client"
|
|
"github.com/theupdateframework/notary/tuf/data"
|
|
"gotest.tools/v3/assert"
|
|
is "gotest.tools/v3/assert/cmp"
|
|
)
|
|
|
|
func TestMatchReleasedSignaturesSortOrder(t *testing.T) {
|
|
releasesRole := data.DelegationRole{BaseRole: data.BaseRole{Name: trust.ReleasesRole}}
|
|
targets := []client.TargetSignedStruct{
|
|
{Target: client.Target{Name: "target10-foo"}, Role: releasesRole},
|
|
{Target: client.Target{Name: "target1-foo"}, Role: releasesRole},
|
|
{Target: client.Target{Name: "target2-foo"}, Role: releasesRole},
|
|
}
|
|
|
|
rows := matchReleasedSignatures(targets)
|
|
|
|
targetNames := make([]string, 0, len(rows))
|
|
for _, r := range rows {
|
|
targetNames = append(targetNames, r.SignedTag)
|
|
}
|
|
expected := []string{
|
|
"target1-foo",
|
|
"target2-foo",
|
|
"target10-foo",
|
|
}
|
|
assert.Check(t, is.DeepEqual(expected, targetNames))
|
|
}
|