From 4b9a2b07fcbab098f21bea94e6593b598dc2bf05 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Tue, 29 Jul 2025 19:39:20 +0200 Subject: [PATCH] vendor: github.com/docker/docker, docker/cli v28.3.3 Signed-off-by: Sebastiaan van Stijn --- go.mod | 4 +- go.sum | 8 +-- .../cli/cli/command/formatter/buildcache.go | 5 +- .../cli/cli/command/formatter/container.go | 5 +- .../cli/cli/command/formatter/disk_usage.go | 2 +- .../cli/cli/command/formatter/displayutils.go | 19 ++++++ .../docker/cli/cli/command/formatter/image.go | 5 +- .../cli/cli/command/formatter/volume.go | 2 +- .../docker/api/types/registry/authconfig.go | 2 + .../docker/docker/client/image_push.go | 11 +++- .../docker/docker/pkg/stringid/stringid.go | 63 ------------------- vendor/modules.txt | 5 +- 12 files changed, 47 insertions(+), 84 deletions(-) delete mode 100644 vendor/github.com/docker/docker/pkg/stringid/stringid.go diff --git a/go.mod b/go.mod index d073856aa..e31bc90e6 100644 --- a/go.mod +++ b/go.mod @@ -16,9 +16,9 @@ require ( github.com/creack/pty v1.1.24 github.com/davecgh/go-spew v1.1.1 github.com/distribution/reference v0.6.0 - github.com/docker/cli v28.3.2+incompatible + github.com/docker/cli v28.3.3+incompatible github.com/docker/cli-docs-tool v0.10.0 - github.com/docker/docker v28.3.2+incompatible + github.com/docker/docker v28.3.3+incompatible github.com/docker/go-units v0.5.0 github.com/gofrs/flock v0.12.1 github.com/google/go-dap v0.12.0 diff --git a/go.sum b/go.sum index 93eab27d1..69d1d2a4a 100644 --- a/go.sum +++ b/go.sum @@ -108,15 +108,15 @@ github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5Qvfr github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E= github.com/dlclark/regexp2 v1.11.0 h1:G/nrcoOa7ZXlpoa/91N3X7mM3r8eIlMBBJZvsz/mxKI= github.com/dlclark/regexp2 v1.11.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= -github.com/docker/cli v28.3.2+incompatible h1:mOt9fcLE7zaACbxW1GeS65RI67wIJrTnqS3hP2huFsY= -github.com/docker/cli v28.3.2+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= +github.com/docker/cli v28.3.3+incompatible h1:fp9ZHAr1WWPGdIWBM1b3zLtgCF+83gRdVMTJsUeiyAo= +github.com/docker/cli v28.3.3+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= github.com/docker/cli-docs-tool v0.10.0 h1:bOD6mKynPQgojQi3s2jgcUWGp/Ebqy1SeCr9VfKQLLU= github.com/docker/cli-docs-tool v0.10.0/go.mod h1:5EM5zPnT2E7yCLERZmrDA234Vwn09fzRHP4aX1qwp1U= github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/distribution v2.8.3+incompatible h1:AtKxIZ36LoNK51+Z6RpzLpddBirtxJnzDrHLEKxTAYk= github.com/docker/distribution v2.8.3+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= -github.com/docker/docker v28.3.2+incompatible h1:wn66NJ6pWB1vBZIilP8G3qQPqHy5XymfYn5vsqeA5oA= -github.com/docker/docker v28.3.2+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v28.3.3+incompatible h1:Dypm25kh4rmk49v1eiVbsAtpAsYURjYkaKubwuBdxEI= +github.com/docker/docker v28.3.3+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/docker-credential-helpers v0.9.3 h1:gAm/VtF9wgqJMoxzT3Gj5p4AqIjCBS4wrsOh9yRqcz8= github.com/docker/docker-credential-helpers v0.9.3/go.mod h1:x+4Gbw9aGmChi3qTLZj8Dfn0TD20M/fuWy0E5+WDeCo= github.com/docker/go v1.5.1-1.0.20160303222718-d30aec9fd63c h1:lzqkGL9b3znc+ZUgi7FlLnqjQhcXxkNM/quxIjBVMD0= diff --git a/vendor/github.com/docker/cli/cli/command/formatter/buildcache.go b/vendor/github.com/docker/cli/cli/command/formatter/buildcache.go index a170e0eaf..ade5de73f 100644 --- a/vendor/github.com/docker/cli/cli/command/formatter/buildcache.go +++ b/vendor/github.com/docker/cli/cli/command/formatter/buildcache.go @@ -7,7 +7,6 @@ import ( "time" "github.com/docker/docker/api/types/build" - "github.com/docker/docker/pkg/stringid" "github.com/docker/go-units" ) @@ -115,7 +114,7 @@ func (c *buildCacheContext) MarshalJSON() ([]byte, error) { func (c *buildCacheContext) ID() string { id := c.v.ID if c.trunc { - id = stringid.TruncateID(c.v.ID) + id = TruncateID(c.v.ID) } if c.v.InUse { return id + "*" @@ -131,7 +130,7 @@ func (c *buildCacheContext) Parent() string { parent = c.v.Parent //nolint:staticcheck // Ignore SA1019: Field was deprecated in API v1.42, but kept for backward compatibility } if c.trunc { - return stringid.TruncateID(parent) + return TruncateID(parent) } return parent } diff --git a/vendor/github.com/docker/cli/cli/command/formatter/container.go b/vendor/github.com/docker/cli/cli/command/formatter/container.go index 4480221fb..0a5c587af 100644 --- a/vendor/github.com/docker/cli/cli/command/formatter/container.go +++ b/vendor/github.com/docker/cli/cli/command/formatter/container.go @@ -14,7 +14,6 @@ import ( "github.com/containerd/platforms" "github.com/distribution/reference" "github.com/docker/docker/api/types/container" - "github.com/docker/docker/pkg/stringid" "github.com/docker/go-units" ocispec "github.com/opencontainers/image-spec/specs-go/v1" ) @@ -135,7 +134,7 @@ func (c *ContainerContext) MarshalJSON() ([]byte, error) { // option being set, the full or truncated ID is returned. func (c *ContainerContext) ID() string { if c.trunc { - return stringid.TruncateID(c.c.ID) + return TruncateID(c.c.ID) } return c.c.ID } @@ -172,7 +171,7 @@ func (c *ContainerContext) Image() string { return "" } if c.trunc { - if trunc := stringid.TruncateID(c.c.ImageID); trunc == stringid.TruncateID(c.c.Image) { + if trunc := TruncateID(c.c.ImageID); trunc == TruncateID(c.c.Image) { return trunc } // truncate digest if no-trunc option was not selected diff --git a/vendor/github.com/docker/cli/cli/command/formatter/disk_usage.go b/vendor/github.com/docker/cli/cli/command/formatter/disk_usage.go index 770697f3c..b663c59b2 100644 --- a/vendor/github.com/docker/cli/cli/command/formatter/disk_usage.go +++ b/vendor/github.com/docker/cli/cli/command/formatter/disk_usage.go @@ -11,7 +11,7 @@ import ( "github.com/docker/docker/api/types/container" "github.com/docker/docker/api/types/image" "github.com/docker/docker/api/types/volume" - units "github.com/docker/go-units" + "github.com/docker/go-units" ) const ( diff --git a/vendor/github.com/docker/cli/cli/command/formatter/displayutils.go b/vendor/github.com/docker/cli/cli/command/formatter/displayutils.go index c6d2845c4..b062c3391 100644 --- a/vendor/github.com/docker/cli/cli/command/formatter/displayutils.go +++ b/vendor/github.com/docker/cli/cli/command/formatter/displayutils.go @@ -27,6 +27,25 @@ func charWidth(r rune) int { } } +const shortLen = 12 + +// TruncateID returns a shorthand version of a string identifier for presentation, +// after trimming digest algorithm prefix (if any). +// +// This function is a copy of [stringid.TruncateID] for presentation / formatting +// purposes. +// +// [stringid.TruncateID]: https://github.com/moby/moby/blob/v28.3.2/pkg/stringid/stringid.go#L19 +func TruncateID(id string) string { + if i := strings.IndexRune(id, ':'); i >= 0 { + id = id[i+1:] + } + if len(id) > shortLen { + id = id[:shortLen] + } + return id +} + // Ellipsis truncates a string to fit within maxDisplayWidth, and appends ellipsis (…). // For maxDisplayWidth of 1 and lower, no ellipsis is appended. // For maxDisplayWidth of 1, first char of string will return even if its width > 1. diff --git a/vendor/github.com/docker/cli/cli/command/formatter/image.go b/vendor/github.com/docker/cli/cli/command/formatter/image.go index d16f42b5b..74c2fe758 100644 --- a/vendor/github.com/docker/cli/cli/command/formatter/image.go +++ b/vendor/github.com/docker/cli/cli/command/formatter/image.go @@ -6,8 +6,7 @@ import ( "github.com/distribution/reference" "github.com/docker/docker/api/types/image" - "github.com/docker/docker/pkg/stringid" - units "github.com/docker/go-units" + "github.com/docker/go-units" ) const ( @@ -216,7 +215,7 @@ func (c *imageContext) MarshalJSON() ([]byte, error) { func (c *imageContext) ID() string { if c.trunc { - return stringid.TruncateID(c.i.ID) + return TruncateID(c.i.ID) } return c.i.ID } diff --git a/vendor/github.com/docker/cli/cli/command/formatter/volume.go b/vendor/github.com/docker/cli/cli/command/formatter/volume.go index 85f070793..bf9ea5d44 100644 --- a/vendor/github.com/docker/cli/cli/command/formatter/volume.go +++ b/vendor/github.com/docker/cli/cli/command/formatter/volume.go @@ -6,7 +6,7 @@ import ( "strings" "github.com/docker/docker/api/types/volume" - units "github.com/docker/go-units" + "github.com/docker/go-units" ) const ( diff --git a/vendor/github.com/docker/docker/api/types/registry/authconfig.go b/vendor/github.com/docker/docker/api/types/registry/authconfig.go index 70f732007..fa9037bda 100644 --- a/vendor/github.com/docker/docker/api/types/registry/authconfig.go +++ b/vendor/github.com/docker/docker/api/types/registry/authconfig.go @@ -83,6 +83,8 @@ func DecodeAuthConfig(authEncoded string) (*AuthConfig, error) { // Like [DecodeAuthConfig], this function always returns an [AuthConfig], even if an // error occurs. It is up to the caller to decide if authentication is required, // and if the error can be ignored. +// +// Deprecated: this function is no longer used and will be removed in the next release. func DecodeAuthConfigBody(rdr io.ReadCloser) (*AuthConfig, error) { return decodeAuthConfigFromReader(rdr) } diff --git a/vendor/github.com/docker/docker/client/image_push.go b/vendor/github.com/docker/docker/client/image_push.go index cbbe9a25d..8dbe0b1e5 100644 --- a/vendor/github.com/docker/docker/client/image_push.go +++ b/vendor/github.com/docker/docker/client/image_push.go @@ -66,7 +66,16 @@ func (cli *Client) ImagePush(ctx context.Context, image string, options image.Pu } func (cli *Client) tryImagePush(ctx context.Context, imageID string, query url.Values, registryAuth string) (*http.Response, error) { - return cli.post(ctx, "/images/"+imageID+"/push", query, nil, http.Header{ + // Always send a body (which may be an empty JSON document ("{}")) to prevent + // EOF errors on older daemons which had faulty fallback code for handling + // authentication in the body when no auth-header was set, resulting in; + // + // Error response from daemon: bad parameters and missing X-Registry-Auth: invalid X-Registry-Auth header: EOF + // + // We use [http.NoBody], which gets marshaled to an empty JSON document. + // + // see: https://github.com/moby/moby/commit/ea29dffaa541289591aa44fa85d2a596ce860e16 + return cli.post(ctx, "/images/"+imageID+"/push", query, http.NoBody, http.Header{ registry.AuthHeader: {registryAuth}, }) } diff --git a/vendor/github.com/docker/docker/pkg/stringid/stringid.go b/vendor/github.com/docker/docker/pkg/stringid/stringid.go deleted file mode 100644 index 919cd5a50..000000000 --- a/vendor/github.com/docker/docker/pkg/stringid/stringid.go +++ /dev/null @@ -1,63 +0,0 @@ -// Package stringid provides helper functions for dealing with string identifiers -package stringid - -import ( - "crypto/rand" - "encoding/hex" - "strings" -) - -const ( - shortLen = 12 - fullLen = 64 -) - -// TruncateID returns a shorthand version of a string identifier for convenience. -// A collision with other shorthands is very unlikely, but possible. -// In case of a collision a lookup with TruncIndex.Get() will fail, and the caller -// will need to use a longer prefix, or the full-length Id. -func TruncateID(id string) string { - if i := strings.IndexRune(id, ':'); i >= 0 { - id = id[i+1:] - } - if len(id) > shortLen { - id = id[:shortLen] - } - return id -} - -// GenerateRandomID returns a unique, 64-character ID consisting of a-z, 0-9. -// It guarantees that the ID, when truncated ([TruncateID]) does not consist -// of numbers only, so that the truncated ID can be used as hostname for -// containers. -func GenerateRandomID() string { - b := make([]byte, 32) - for { - if _, err := rand.Read(b); err != nil { - panic(err) // This shouldn't happen - } - id := hex.EncodeToString(b) - - // make sure that the truncated ID does not consist of only numeric - // characters, as it's used as default hostname for containers. - // - // See: - // - https://github.com/moby/moby/issues/3869 - // - https://bugzilla.redhat.com/show_bug.cgi?id=1059122 - if allNum(id[:shortLen]) { - // all numbers; try again - continue - } - return id - } -} - -// allNum checks whether id consists of only numbers (0-9). -func allNum(id string) bool { - for _, c := range []byte(id) { - if c > '9' || c < '0' { - return false - } - } - return true -} diff --git a/vendor/modules.txt b/vendor/modules.txt index 96e078e9e..c90aebb18 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -218,7 +218,7 @@ github.com/davecgh/go-spew/spew # github.com/distribution/reference v0.6.0 ## explicit; go 1.20 github.com/distribution/reference -# github.com/docker/cli v28.3.2+incompatible +# github.com/docker/cli v28.3.3+incompatible ## explicit github.com/docker/cli/cli github.com/docker/cli/cli-plugins/metadata @@ -256,7 +256,7 @@ github.com/docker/cli-docs-tool github.com/docker/cli-docs-tool/annotation # github.com/docker/distribution v2.8.3+incompatible ## explicit -# github.com/docker/docker v28.3.2+incompatible +# github.com/docker/docker v28.3.3+incompatible ## explicit github.com/docker/docker/api github.com/docker/docker/api/types @@ -285,7 +285,6 @@ github.com/docker/docker/internal/multierror github.com/docker/docker/pkg/jsonmessage github.com/docker/docker/pkg/namesgenerator github.com/docker/docker/pkg/stdcopy -github.com/docker/docker/pkg/stringid # github.com/docker/docker-credential-helpers v0.9.3 ## explicit; go 1.21 github.com/docker/docker-credential-helpers/client