From 3599b8e599d69a9f9e949def104da5c8d6094d88 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 11 Sep 2024 23:58:28 +0800 Subject: [PATCH] chore(deps): bump github.com/docker/cli from 26.1.5+incompatible to 27.2.1+incompatible (#2667) * chore(deps): bump github.com/docker/cli Bumps [github.com/docker/cli](https://github.com/docker/cli) from 26.1.5+incompatible to 27.2.1+incompatible. - [Commits](https://github.com/docker/cli/compare/v26.1.5...v27.2.1) --- updated-dependencies: - dependency-name: github.com/docker/cli dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] * chore: update docker library version --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Qiao Han --- go.mod | 4 ++-- go.sum | 8 ++++---- internal/db/branch/create/create.go | 6 +++--- internal/db/branch/delete/delete.go | 6 +++--- internal/start/start_test.go | 5 +++-- internal/stop/stop_test.go | 10 ++++++---- internal/testing/apitest/docker.go | 9 +++++---- internal/utils/docker.go | 16 ++++++---------- internal/utils/docker_test.go | 5 +++-- test/branch_test.go | 6 +++--- 10 files changed, 38 insertions(+), 37 deletions(-) diff --git a/go.mod b/go.mod index 09427deeb..20656c2f5 100644 --- a/go.mod +++ b/go.mod @@ -14,8 +14,8 @@ require ( github.com/containers/common v0.59.2 github.com/danieljoos/wincred v1.2.1 github.com/deepmap/oapi-codegen/v2 v2.2.0 - github.com/docker/cli v26.1.5+incompatible - github.com/docker/docker v26.1.5+incompatible + github.com/docker/cli v27.2.1+incompatible + github.com/docker/docker v27.2.1+incompatible github.com/docker/go-connections v0.5.0 github.com/docker/go-units v0.5.0 github.com/getsentry/sentry-go v0.28.1 diff --git a/go.sum b/go.sum index 9dcf2a2a7..9b4c057b8 100644 --- a/go.sum +++ b/go.sum @@ -234,13 +234,13 @@ github.com/dlclark/regexp2 v1.4.0 h1:F1rxgk7p4uKjwIQxBs9oAXe5CqrXlCduYEJvrF4u93E github.com/dlclark/regexp2 v1.4.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= github.com/dnephin/pflag v1.0.7 h1:oxONGlWxhmUct0YzKTgrpQv9AUA1wtPBn7zuSjJqptk= github.com/dnephin/pflag v1.0.7/go.mod h1:uxE91IoWURlOiTUIA8Mq5ZZkAv3dPUfZNaT80Zm7OQE= -github.com/docker/cli v26.1.5+incompatible h1:NxXGSdz2N+Ibdaw330TDO3d/6/f7MvHuiMbuFaIQDTk= -github.com/docker/cli v26.1.5+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= +github.com/docker/cli v27.2.1+incompatible h1:U5BPtiD0viUzjGAjV1p0MGB8eVA3L3cbIrnyWmSJI70= +github.com/docker/cli v27.2.1+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= 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 v26.1.5+incompatible h1:NEAxTwEjxV6VbBMBoGG3zPqbiJosIApZjxlbrG9q3/g= -github.com/docker/docker v26.1.5+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v27.2.1+incompatible h1:fQdiLfW7VLscyoeYEBz7/J8soYFDZV1u6VW6gJEjNMI= +github.com/docker/docker v27.2.1+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/internal/db/branch/create/create.go b/internal/db/branch/create/create.go index 98996e8c9..085e10f9d 100644 --- a/internal/db/branch/create/create.go +++ b/internal/db/branch/create/create.go @@ -9,7 +9,7 @@ import ( "os" "path/filepath" - "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/container" "github.com/docker/docker/pkg/stdcopy" "github.com/go-errors/errors" "github.com/spf13/afero" @@ -70,7 +70,7 @@ func assertNewBranchIsValid(branchPath string, fsys afero.Fs) error { } func createBranch(ctx context.Context, branch string) error { - exec, err := utils.Docker.ContainerExecCreate(ctx, utils.DbId, types.ExecConfig{ + exec, err := utils.Docker.ContainerExecCreate(ctx, utils.DbId, container.ExecOptions{ Cmd: []string{"/bin/bash", "-c", cloneScript}, Env: []string{"DB_NAME=" + branch}, AttachStderr: true, @@ -80,7 +80,7 @@ func createBranch(ctx context.Context, branch string) error { return err } // Read exec output - resp, err := utils.Docker.ContainerExecAttach(ctx, exec.ID, types.ExecStartCheck{}) + resp, err := utils.Docker.ContainerExecAttach(ctx, exec.ID, container.ExecStartOptions{}) if err != nil { return err } diff --git a/internal/db/branch/delete/delete.go b/internal/db/branch/delete/delete.go index a3bfde6f9..f59f5e51c 100644 --- a/internal/db/branch/delete/delete.go +++ b/internal/db/branch/delete/delete.go @@ -7,7 +7,7 @@ import ( "io" "path/filepath" - "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/container" "github.com/docker/docker/pkg/stdcopy" "github.com/go-errors/errors" "github.com/spf13/afero" @@ -58,7 +58,7 @@ func deleteBranchDir(branch string, fsys afero.Fs) error { } func deleteBranchPG(ctx context.Context, branch string) error { - exec, err := utils.Docker.ContainerExecCreate(ctx, utils.DbId, types.ExecConfig{ + exec, err := utils.Docker.ContainerExecCreate(ctx, utils.DbId, container.ExecOptions{ Cmd: []string{"dropdb", "--username", "postgres", "--host", "127.0.0.1", branch}, AttachStderr: true, AttachStdout: true, @@ -67,7 +67,7 @@ func deleteBranchPG(ctx context.Context, branch string) error { return err } // Read exec output - resp, err := utils.Docker.ContainerExecAttach(ctx, exec.ID, types.ExecStartCheck{}) + resp, err := utils.Docker.ContainerExecAttach(ctx, exec.ID, container.ExecStartOptions{}) if err != nil { return err } diff --git a/internal/start/start_test.go b/internal/start/start_test.go index 645a1cd70..654831ccb 100644 --- a/internal/start/start_test.go +++ b/internal/start/start_test.go @@ -10,6 +10,7 @@ import ( "testing" "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/network" "github.com/docker/docker/api/types/volume" "github.com/h2non/gock" "github.com/jackc/pgconn" @@ -85,7 +86,7 @@ func TestDatabaseStart(t *testing.T) { gock.New(utils.Docker.DaemonHost()). Post("/v" + utils.Docker.ClientVersion() + "/networks/create"). Reply(http.StatusCreated). - JSON(types.NetworkCreateResponse{}) + JSON(network.CreateResponse{}) // Caches all dependencies imageUrl := utils.GetRegistryImageUrl(utils.Config.Db.Image) gock.New(utils.Docker.DaemonHost()). @@ -201,7 +202,7 @@ func TestDatabaseStart(t *testing.T) { gock.New(utils.Docker.DaemonHost()). Post("/v" + utils.Docker.ClientVersion() + "/networks/create"). Reply(http.StatusCreated). - JSON(types.NetworkCreateResponse{}) + JSON(network.CreateResponse{}) // Caches all dependencies imageUrl := utils.GetRegistryImageUrl(utils.Config.Db.Image) gock.New(utils.Docker.DaemonHost()). diff --git a/internal/stop/stop_test.go b/internal/stop/stop_test.go index dbb8b9030..419df28bc 100644 --- a/internal/stop/stop_test.go +++ b/internal/stop/stop_test.go @@ -9,6 +9,8 @@ import ( "testing" "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/container" + "github.com/docker/docker/api/types/network" "github.com/docker/docker/api/types/volume" "github.com/h2non/gock" "github.com/spf13/afero" @@ -33,11 +35,11 @@ func TestStopCommand(t *testing.T) { gock.New(utils.Docker.DaemonHost()). Post("/v" + utils.Docker.ClientVersion() + "/containers/prune"). Reply(http.StatusOK). - JSON(types.ContainersPruneReport{}) + JSON(container.PruneReport{}) gock.New(utils.Docker.DaemonHost()). Post("/v" + utils.Docker.ClientVersion() + "/networks/prune"). Reply(http.StatusOK). - JSON(types.NetworksPruneReport{}) + JSON(network.PruneReport{}) gock.New(utils.Docker.DaemonHost()). Get("/v" + utils.Docker.ClientVersion() + "/volumes"). Reply(http.StatusOK). @@ -94,11 +96,11 @@ func TestStopServices(t *testing.T) { gock.New(utils.Docker.DaemonHost()). Post("/v" + utils.Docker.ClientVersion() + "/containers/prune"). Reply(http.StatusOK). - JSON(types.ContainersPruneReport{}) + JSON(container.PruneReport{}) gock.New(utils.Docker.DaemonHost()). Post("/v" + utils.Docker.ClientVersion() + "/networks/prune"). Reply(http.StatusOK). - JSON(types.NetworksPruneReport{}) + JSON(network.PruneReport{}) // Run test err := stop(context.Background(), true, io.Discard) // Check error diff --git a/internal/testing/apitest/docker.go b/internal/testing/apitest/docker.go index 37f5549ee..21a4d7dd2 100644 --- a/internal/testing/apitest/docker.go +++ b/internal/testing/apitest/docker.go @@ -8,6 +8,7 @@ import ( "github.com/docker/docker/api" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/container" + "github.com/docker/docker/api/types/network" "github.com/docker/docker/api/types/volume" "github.com/docker/docker/client" "github.com/docker/docker/pkg/stdcopy" @@ -38,7 +39,7 @@ func MockDockerStart(docker *client.Client, image, containerID string) { gock.New(docker.DaemonHost()). Post("/v" + docker.ClientVersion() + "/networks/create"). Reply(http.StatusCreated). - JSON(types.NetworkCreateResponse{}) + JSON(network.CreateResponse{}) gock.New(docker.DaemonHost()). Post("/v" + docker.ClientVersion() + "/volumes/create"). Persist(). @@ -62,15 +63,15 @@ func MockDockerStop(docker *client.Client) { gock.New(docker.DaemonHost()). Post("/v" + docker.ClientVersion() + "/containers/prune"). Reply(http.StatusOK). - JSON(types.ContainersPruneReport{}) + JSON(container.PruneReport{}) gock.New(docker.DaemonHost()). Post("/v" + docker.ClientVersion() + "/volumes/prune"). Reply(http.StatusOK). - JSON(types.VolumesPruneReport{}) + JSON(volume.PruneReport{}) gock.New(docker.DaemonHost()). Post("/v" + docker.ClientVersion() + "/networks/prune"). Reply(http.StatusOK). - JSON(types.NetworksPruneReport{}) + JSON(network.PruneReport{}) } // Ref: internal/utils/docker.go::DockerRunOnce diff --git a/internal/utils/docker.go b/internal/utils/docker.go index 8a44c75d3..678d93e98 100644 --- a/internal/utils/docker.go +++ b/internal/utils/docker.go @@ -20,7 +20,6 @@ import ( dockerConfig "github.com/docker/cli/cli/config" dockerFlags "github.com/docker/cli/cli/flags" "github.com/docker/cli/cli/streams" - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/container" "github.com/docker/docker/api/types/filters" "github.com/docker/docker/api/types/image" @@ -65,10 +64,7 @@ func DockerNetworkCreateIfNotExists(ctx context.Context, mode container.NetworkM if !isUserDefined(mode) { return nil } - _, err := Docker.NetworkCreate(ctx, mode.NetworkName(), types.NetworkCreate{ - CheckDuplicate: true, - Labels: labels, - }) + _, err := Docker.NetworkCreate(ctx, mode.NetworkName(), network.CreateOptions{Labels: labels}) // if error is network already exists, no need to propagate to user if errdefs.IsConflict(err) || errors.Is(err, podman.ErrNetworkExists) { return nil @@ -410,19 +406,19 @@ func DockerStreamLogsOnce(ctx context.Context, containerId string, stdout, stder } // Exec a command once inside a container, returning stdout and throwing error on non-zero exit code. -func DockerExecOnce(ctx context.Context, container string, env []string, cmd []string) (string, error) { +func DockerExecOnce(ctx context.Context, containerId string, env []string, cmd []string) (string, error) { stderr := io.Discard if viper.GetBool("DEBUG") { stderr = os.Stderr } var out bytes.Buffer - err := DockerExecOnceWithStream(ctx, container, "", env, cmd, &out, stderr) + err := DockerExecOnceWithStream(ctx, containerId, "", env, cmd, &out, stderr) return out.String(), err } -func DockerExecOnceWithStream(ctx context.Context, container, workdir string, env, cmd []string, stdout, stderr io.Writer) error { +func DockerExecOnceWithStream(ctx context.Context, containerId, workdir string, env, cmd []string, stdout, stderr io.Writer) error { // Reset shadow database - exec, err := Docker.ContainerExecCreate(ctx, container, types.ExecConfig{ + exec, err := Docker.ContainerExecCreate(ctx, containerId, container.ExecOptions{ Env: env, Cmd: cmd, WorkingDir: workdir, @@ -433,7 +429,7 @@ func DockerExecOnceWithStream(ctx context.Context, container, workdir string, en return errors.Errorf("failed to exec docker create: %w", err) } // Read exec output - resp, err := Docker.ContainerExecAttach(ctx, exec.ID, types.ExecStartCheck{}) + resp, err := Docker.ContainerExecAttach(ctx, exec.ID, container.ExecStartOptions{}) if err != nil { return errors.Errorf("failed to exec docker attach: %w", err) } diff --git a/internal/utils/docker_test.go b/internal/utils/docker_test.go index a3f92bd01..6a0cdf034 100644 --- a/internal/utils/docker_test.go +++ b/internal/utils/docker_test.go @@ -9,6 +9,7 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/container" + "github.com/docker/docker/api/types/network" "github.com/docker/docker/pkg/jsonmessage" "github.com/docker/docker/pkg/stdcopy" "github.com/h2non/gock" @@ -133,7 +134,7 @@ func TestRunOnce(t *testing.T) { gock.New(Docker.DaemonHost()). Post("/v" + Docker.ClientVersion() + "/networks/create"). Reply(http.StatusCreated). - JSON(types.NetworkCreateResponse{}) + JSON(network.CreateResponse{}) gock.New(Docker.DaemonHost()). Post("/v" + Docker.ClientVersion() + "/containers/create"). Reply(http.StatusServiceUnavailable) @@ -155,7 +156,7 @@ func TestRunOnce(t *testing.T) { gock.New(Docker.DaemonHost()). Post("/v" + Docker.ClientVersion() + "/networks/create"). Reply(http.StatusCreated). - JSON(types.NetworkCreateResponse{}) + JSON(network.CreateResponse{}) gock.New(Docker.DaemonHost()). Post("/v" + Docker.ClientVersion() + "/containers/create"). Reply(http.StatusOK). diff --git a/test/branch_test.go b/test/branch_test.go index a3d869024..07d3608d2 100644 --- a/test/branch_test.go +++ b/test/branch_test.go @@ -5,7 +5,7 @@ import ( "encoding/json" "os" - "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/container" "github.com/stretchr/testify/require" ) @@ -31,8 +31,8 @@ func (suite *DBTestSuite) TestBranchCreate() { // check commands in exec calls require.Equal(suite.T(), 2, len(suite.bodies)) - var execBody types.ExecConfig + var execBody container.ExecOptions require.NoError(suite.T(), json.Unmarshal([]byte(suite.bodies[0]), &execBody)) - var startBody types.ExecStartCheck + var startBody container.ExecStartOptions require.NoError(suite.T(), json.Unmarshal([]byte(suite.bodies[1]), &startBody)) }