From f8b282f72bcc98400bb7356cccd677037b4a8c1f Mon Sep 17 00:00:00 2001 From: dhurley Date: Tue, 2 Apr 2024 11:51:30 +0100 Subject: [PATCH] Bump docker dependency to version v24.0.9 --- go.work.sum | 2 ++ test/integration/go.mod | 1 + test/integration/go.sum | 4 ++-- .../github.com/docker/docker/api/swagger.yaml | 4 +--- .../docker/docker/client/container_wait.go | 8 +++++-- .../docker/docker/pkg/idtools/idtools_unix.go | 14 ++++--------- .../docker/docker/pkg/ioutils/readers.go | 21 +++++++++++++++++++ .../docker/docker/pkg/ioutils/writers.go | 10 ++++++++- .../docker/docker/registry/config.go | 4 ++-- test/integration/vendor/modules.txt | 3 ++- 10 files changed, 50 insertions(+), 21 deletions(-) diff --git a/go.work.sum b/go.work.sum index 0324b1cdf..ded35a8f4 100644 --- a/go.work.sum +++ b/go.work.sum @@ -1718,6 +1718,8 @@ github.com/docker/docker v23.0.5+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bc github.com/docker/docker v24.0.0-rc.2.0.20230718135204-8e51b8b59cb8+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/docker v24.0.4+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/docker v24.0.5+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v24.0.9+incompatible h1:HPGzNmwfLZWdxHqK9/II92pyi1EpYKsAqcl4G0Of9v0= +github.com/docker/docker v24.0.9+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/docker v25.0.2+incompatible h1:/OaKeauroa10K4Nqavw4zlhcDq/WBcPMc5DbjOGgozY= github.com/docker/docker v25.0.2+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/docker-credential-helpers v0.6.3/go.mod h1:WRaJzqw3CTB9bk10avuGsjVBZsD05qeibJ1/TYlvc0Y= diff --git a/test/integration/go.mod b/test/integration/go.mod index 222cbdebc..651d3ed6b 100644 --- a/test/integration/go.mod +++ b/test/integration/go.mod @@ -213,6 +213,7 @@ require ( replace ( github.com/containerd/containerd => github.com/containerd/containerd v1.7.11 github.com/cucumber/godog => github.com/laurazard/godog v0.0.0-20220922095256-4c4b17abdae7 + github.com/docker/docker => github.com/docker/docker v24.0.9+incompatible github.com/moby/buildkit => github.com/moby/buildkit v0.12.5 github.com/nginx/agent/sdk/v2 => ./../../sdk github.com/nginx/agent/v2 => ./../../ diff --git a/test/integration/go.sum b/test/integration/go.sum index d79abaaa7..5d46c0282 100644 --- a/test/integration/go.sum +++ b/test/integration/go.sum @@ -139,8 +139,8 @@ github.com/docker/compose/v2 v2.20.3/go.mod h1:xbMcMnkNJQfwh1PlMie2DfzIYAcqhtc2i 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 v24.0.7+incompatible h1:Wo6l37AuwP3JaMnZa226lzVXGA3F9Ig1seQen0cKYlM= -github.com/docker/docker v24.0.7+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v24.0.9+incompatible h1:HPGzNmwfLZWdxHqK9/II92pyi1EpYKsAqcl4G0Of9v0= +github.com/docker/docker v24.0.9+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/docker-credential-helpers v0.8.1 h1:j/eKUktUltBtMzKqmfLB0PAgqYyMHOp5vfsD1807oKo= github.com/docker/docker-credential-helpers v0.8.1/go.mod h1:P3ci7E3lwkZg6XiHdRKft1KckHiO9a2rNtyFbZ/ry9M= github.com/docker/go v1.5.1-1.0.20160303222718-d30aec9fd63c h1:lzqkGL9b3znc+ZUgi7FlLnqjQhcXxkNM/quxIjBVMD0= diff --git a/test/integration/vendor/github.com/docker/docker/api/swagger.yaml b/test/integration/vendor/github.com/docker/docker/api/swagger.yaml index 7635b9f66..d98bc1bfd 100644 --- a/test/integration/vendor/github.com/docker/docker/api/swagger.yaml +++ b/test/integration/vendor/github.com/docker/docker/api/swagger.yaml @@ -3011,8 +3011,6 @@ definitions: Name: "journald" - Type: "Log" Name: "json-file" - - Type: "Log" - Name: "logentries" - Type: "Log" Name: "splunk" - Type: "Log" @@ -5334,7 +5332,7 @@ definitions: type: "array" items: type: "string" - example: ["awslogs", "fluentd", "gcplogs", "gelf", "journald", "json-file", "logentries", "splunk", "syslog"] + example: ["awslogs", "fluentd", "gcplogs", "gelf", "journald", "json-file", "splunk", "syslog"] RegistryServiceConfig: diff --git a/test/integration/vendor/github.com/docker/docker/client/container_wait.go b/test/integration/vendor/github.com/docker/docker/client/container_wait.go index 2375eb1e8..b7d80542c 100644 --- a/test/integration/vendor/github.com/docker/docker/client/container_wait.go +++ b/test/integration/vendor/github.com/docker/docker/client/container_wait.go @@ -66,8 +66,12 @@ func (cli *Client) ContainerWait(ctx context.Context, containerID string, condit // // If there's a JSON parsing error, read the real error message // off the body and send it to the client. - _, _ = io.ReadAll(io.LimitReader(stream, containerWaitErrorMsgLimit)) - errC <- errors.New(responseText.String()) + if errors.As(err, new(*json.SyntaxError)) { + _, _ = io.ReadAll(io.LimitReader(stream, containerWaitErrorMsgLimit)) + errC <- errors.New(responseText.String()) + } else { + errC <- err + } return } diff --git a/test/integration/vendor/github.com/docker/docker/pkg/idtools/idtools_unix.go b/test/integration/vendor/github.com/docker/docker/pkg/idtools/idtools_unix.go index a4001c3b8..2194c47d6 100644 --- a/test/integration/vendor/github.com/docker/docker/pkg/idtools/idtools_unix.go +++ b/test/integration/vendor/github.com/docker/docker/pkg/idtools/idtools_unix.go @@ -11,17 +11,11 @@ import ( "os/exec" "path/filepath" "strconv" - "sync" "syscall" "github.com/opencontainers/runc/libcontainer/user" ) -var ( - entOnce sync.Once - getentCmd string -) - func mkdirAs(path string, mode os.FileMode, owner Identity, mkAll, chownExisting bool) error { path, err := filepath.Abs(path) if err != nil { @@ -162,10 +156,10 @@ func getentGroup(name string) (user.Group, error) { } func callGetent(database, key string) (io.Reader, error) { - entOnce.Do(func() { getentCmd, _ = resolveBinary("getent") }) - // if no `getent` command on host, can't do anything else - if getentCmd == "" { - return nil, fmt.Errorf("unable to find getent command") + getentCmd, err := resolveBinary("getent") + // if no `getent` command within the execution environment, can't do anything else + if err != nil { + return nil, fmt.Errorf("unable to find getent command: %w", err) } command := exec.Command(getentCmd, database, key) // we run getent within container filesystem, but without /dev so /dev/null is not available for exec to mock stdin diff --git a/test/integration/vendor/github.com/docker/docker/pkg/ioutils/readers.go b/test/integration/vendor/github.com/docker/docker/pkg/ioutils/readers.go index de00b95e3..d82ae9303 100644 --- a/test/integration/vendor/github.com/docker/docker/pkg/ioutils/readers.go +++ b/test/integration/vendor/github.com/docker/docker/pkg/ioutils/readers.go @@ -3,11 +3,15 @@ package ioutils // import "github.com/docker/docker/pkg/ioutils" import ( "context" "io" + "runtime/debug" + "sync/atomic" // make sure crypto.SHA256, crypto.sha512 and crypto.SHA384 are registered // TODO remove once https://github.com/opencontainers/go-digest/pull/64 is merged. _ "crypto/sha256" _ "crypto/sha512" + + "github.com/sirupsen/logrus" ) // ReadCloserWrapper wraps an io.Reader, and implements an io.ReadCloser @@ -16,10 +20,15 @@ import ( type ReadCloserWrapper struct { io.Reader closer func() error + closed atomic.Bool } // Close calls back the passed closer function func (r *ReadCloserWrapper) Close() error { + if !r.closed.CompareAndSwap(false, true) { + subsequentCloseWarn("ReadCloserWrapper") + return nil + } return r.closer() } @@ -87,6 +96,7 @@ type cancelReadCloser struct { cancel func() pR *io.PipeReader // Stream to read from pW *io.PipeWriter + closed atomic.Bool } // NewCancelReadCloser creates a wrapper that closes the ReadCloser when the @@ -146,6 +156,17 @@ func (p *cancelReadCloser) closeWithError(err error) { // Close closes the wrapper its underlying reader. It will cause // future calls to Read to return io.EOF. func (p *cancelReadCloser) Close() error { + if !p.closed.CompareAndSwap(false, true) { + subsequentCloseWarn("cancelReadCloser") + return nil + } p.closeWithError(io.EOF) return nil } + +func subsequentCloseWarn(name string) { + logrus.Error("subsequent attempt to close " + name) + if logrus.GetLevel() >= logrus.DebugLevel { + logrus.Errorf("stack trace: %s", string(debug.Stack())) + } +} diff --git a/test/integration/vendor/github.com/docker/docker/pkg/ioutils/writers.go b/test/integration/vendor/github.com/docker/docker/pkg/ioutils/writers.go index 61c679497..1f50602f2 100644 --- a/test/integration/vendor/github.com/docker/docker/pkg/ioutils/writers.go +++ b/test/integration/vendor/github.com/docker/docker/pkg/ioutils/writers.go @@ -1,6 +1,9 @@ package ioutils // import "github.com/docker/docker/pkg/ioutils" -import "io" +import ( + "io" + "sync/atomic" +) // NopWriter represents a type which write operation is nop. type NopWriter struct{} @@ -29,9 +32,14 @@ func (f *NopFlusher) Flush() {} type writeCloserWrapper struct { io.Writer closer func() error + closed atomic.Bool } func (r *writeCloserWrapper) Close() error { + if !r.closed.CompareAndSwap(false, true) { + subsequentCloseWarn("WriteCloserWrapper") + return nil + } return r.closer() } diff --git a/test/integration/vendor/github.com/docker/docker/registry/config.go b/test/integration/vendor/github.com/docker/docker/registry/config.go index 2766306ac..88f0e64ed 100644 --- a/test/integration/vendor/github.com/docker/docker/registry/config.go +++ b/test/integration/vendor/github.com/docker/docker/registry/config.go @@ -328,8 +328,8 @@ func ValidateMirror(val string) (string, error) { if uri.Scheme != "http" && uri.Scheme != "https" { return "", invalidParamf("invalid mirror: unsupported scheme %q in %q", uri.Scheme, uri) } - if (uri.Path != "" && uri.Path != "/") || uri.RawQuery != "" || uri.Fragment != "" { - return "", invalidParamf("invalid mirror: path, query, or fragment at end of the URI %q", uri) + if uri.RawQuery != "" || uri.Fragment != "" { + return "", invalidParamf("invalid mirror: query or fragment at end of the URI %q", uri) } if uri.User != nil { // strip password from output diff --git a/test/integration/vendor/modules.txt b/test/integration/vendor/modules.txt index 201e73d38..3b235d09f 100644 --- a/test/integration/vendor/modules.txt +++ b/test/integration/vendor/modules.txt @@ -288,7 +288,7 @@ github.com/docker/distribution/registry/client/transport github.com/docker/distribution/registry/storage/cache github.com/docker/distribution/registry/storage/cache/memory github.com/docker/distribution/uuid -# github.com/docker/docker v24.0.7+incompatible +# github.com/docker/docker v24.0.7+incompatible => github.com/docker/docker v24.0.9+incompatible ## explicit github.com/docker/docker/api github.com/docker/docker/api/types @@ -1471,6 +1471,7 @@ sigs.k8s.io/structured-merge-diff/v4/value sigs.k8s.io/yaml # github.com/containerd/containerd => github.com/containerd/containerd v1.7.11 # github.com/cucumber/godog => github.com/laurazard/godog v0.0.0-20220922095256-4c4b17abdae7 +# github.com/docker/docker => github.com/docker/docker v24.0.9+incompatible # github.com/moby/buildkit => github.com/moby/buildkit v0.12.5 # github.com/nginx/agent/sdk/v2 => ./../../sdk # github.com/nginx/agent/v2 => ./../../