Bump github.com/docker/cli from 24.0.9+incompatible to 26.1.0+incompatible (#411)

* Bump github.com/docker/cli

Bumps [github.com/docker/cli](https://github.com/docker/cli) from 24.0.9+incompatible to 26.1.0+incompatible.
- [Commits](https://github.com/docker/cli/compare/v24.0.9...v26.1.0)

---
updated-dependencies:
- dependency-name: github.com/docker/cli
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Upgrade docker/docker to matching version

* Tidy go.mod

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Frederik Ring <frederik.ring@gmail.com>
This commit is contained in:
dependabot[bot]
2024-04-25 17:33:07 +02:00
committed by GitHub
parent 7637975e3f
commit 292d47eb19
5 changed files with 91 additions and 39 deletions

View File

@@ -17,6 +17,7 @@ import (
"github.com/cosiner/argv"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/filters"
"github.com/docker/docker/pkg/stdcopy"
"github.com/offen/docker-volume-backup/internal/errwrap"
@@ -96,7 +97,7 @@ func (s *script) runLabeledCommands(label string) error {
Value: fmt.Sprintf("docker-volume-backup.exec-label=%s", s.c.ExecLabel),
})
}
containersWithCommand, err := s.cli.ContainerList(context.Background(), types.ContainerListOptions{
containersWithCommand, err := s.cli.ContainerList(context.Background(), container.ListOptions{
Filters: filters.NewArgs(f...),
})
if err != nil {
@@ -109,7 +110,7 @@ func (s *script) runLabeledCommands(label string) error {
Key: "label",
Value: "docker-volume-backup.exec-pre",
}
deprecatedContainers, err := s.cli.ContainerList(context.Background(), types.ContainerListOptions{
deprecatedContainers, err := s.cli.ContainerList(context.Background(), container.ListOptions{
Filters: filters.NewArgs(f...),
})
if err != nil {
@@ -126,7 +127,7 @@ func (s *script) runLabeledCommands(label string) error {
Key: "label",
Value: "docker-volume-backup.exec-post",
}
deprecatedContainers, err := s.cli.ContainerList(context.Background(), types.ContainerListOptions{
deprecatedContainers, err := s.cli.ContainerList(context.Background(), container.ListOptions{
Filters: filters.NewArgs(f...),
})
if err != nil {

View File

@@ -14,9 +14,11 @@ import (
"github.com/docker/cli/cli/command/service/progress"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/container"
ctr "github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/filters"
"github.com/docker/docker/api/types/swarm"
"github.com/docker/docker/api/types/system"
"github.com/docker/docker/client"
"github.com/offen/docker-volume-backup/internal/errwrap"
)
@@ -65,7 +67,7 @@ func awaitContainerCountForService(cli *client.Client, serviceID string, count i
),
)
case <-poll.C:
containers, err := cli.ContainerList(context.Background(), types.ContainerListOptions{
containers, err := cli.ContainerList(context.Background(), container.ListOptions{
Filters: filters.NewArgs(filters.KeyValuePair{
Key: "label",
Value: fmt.Sprintf("com.docker.swarm.service.id=%s", serviceID),
@@ -82,7 +84,7 @@ func awaitContainerCountForService(cli *client.Client, serviceID string, count i
}
func isSwarm(c interface {
Info(context.Context) (types.Info, error)
Info(context.Context) (system.Info, error)
}) (bool, error) {
info, err := c.Info(context.Background())
if err != nil {
@@ -123,11 +125,11 @@ func (s *script) stopContainersAndServices() (func() error, error) {
labelValue,
)
allContainers, err := s.cli.ContainerList(context.Background(), types.ContainerListOptions{})
allContainers, err := s.cli.ContainerList(context.Background(), container.ListOptions{})
if err != nil {
return noop, errwrap.Wrap(err, "error querying for containers")
}
containersToStop, err := s.cli.ContainerList(context.Background(), types.ContainerListOptions{
containersToStop, err := s.cli.ContainerList(context.Background(), container.ListOptions{
Filters: filters.NewArgs(filters.KeyValuePair{
Key: "label",
Value: filterMatchLabel,
@@ -309,7 +311,7 @@ func (s *script) stopContainersAndServices() (func() error, error) {
continue
}
if err := s.cli.ContainerStart(context.Background(), container.ID, types.ContainerStartOptions{}); err != nil {
if err := s.cli.ContainerStart(context.Background(), container.ID, ctr.StartOptions{}); err != nil {
restartErrors = append(restartErrors, err)
}
}

View File

@@ -5,16 +5,16 @@ import (
"errors"
"testing"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/swarm"
"github.com/docker/docker/api/types/system"
)
type mockInfoClient struct {
result types.Info
result system.Info
err error
}
func (m *mockInfoClient) Info(context.Context) (types.Info, error) {
func (m *mockInfoClient) Info(context.Context) (system.Info, error) {
return m.result, m.err
}
@@ -28,7 +28,7 @@ func TestIsSwarm(t *testing.T) {
{
"swarm",
&mockInfoClient{
result: types.Info{
result: system.Info{
Swarm: swarm.Info{
LocalNodeState: swarm.LocalNodeStateActive,
},
@@ -40,7 +40,7 @@ func TestIsSwarm(t *testing.T) {
{
"compose",
&mockInfoClient{
result: types.Info{
result: system.Info{
Swarm: swarm.Info{
LocalNodeState: swarm.LocalNodeStateInactive,
},
@@ -52,7 +52,7 @@ func TestIsSwarm(t *testing.T) {
{
"balena",
&mockInfoClient{
result: types.Info{
result: system.Info{
Swarm: swarm.Info{
LocalNodeState: "",
},