Consolidated all post-fork updates including dependency bumps and workflow changes

This commit is contained in:
dependabot[bot] 2023-10-04 12:17:38 +02:00 committed by Nick Fedor
parent 2abaa47fd3
commit 6b62d53797
No known key found for this signature in database
GPG key ID: A167CBEDE64D29CB
100 changed files with 1503 additions and 1264 deletions

View file

@ -3,21 +3,21 @@ package container
import (
"bytes"
"fmt"
"io/ioutil"
"io"
"strings"
"time"
"github.com/containrrr/watchtower/pkg/registry"
"github.com/containrrr/watchtower/pkg/registry/digest"
t "github.com/containrrr/watchtower/pkg/types"
"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"
"github.com/docker/docker/api/types/network"
sdkClient "github.com/docker/docker/client"
log "github.com/sirupsen/logrus"
"golang.org/x/net/context"
"github.com/nicholas-fedor/watchtower/pkg/registry"
"github.com/nicholas-fedor/watchtower/pkg/registry/digest"
t "github.com/nicholas-fedor/watchtower/pkg/types"
)
const defaultStopSignal = "SIGTERM"
@ -57,7 +57,6 @@ func NewClient(opts ClientOptions) Client {
// ClientOptions contains the options for how the docker client wrapper should behave
type ClientOptions struct {
PullImages bool
RemoveVolumes bool
IncludeStopped bool
ReviveStopped bool
@ -110,7 +109,7 @@ func (client dockerClient) ListContainers(fn t.Filter) ([]t.Container, error) {
filter := client.createListFilter()
containers, err := client.api.ContainerList(
bg,
types.ContainerListOptions{
container.ListOptions{
Filters: filter,
})
@ -207,7 +206,7 @@ func (client dockerClient) StopContainer(c t.Container, timeout time.Duration) e
} else {
log.Debugf("Removing container %s", shortID)
if err := client.api.ContainerRemove(bg, idStr, types.ContainerRemoveOptions{Force: true, RemoveVolumes: client.RemoveVolumes}); err != nil {
if err := client.api.ContainerRemove(bg, idStr, container.RemoveOptions{Force: true, RemoveVolumes: client.RemoveVolumes}); err != nil {
if sdkClient.IsErrNotFound(err) {
log.Debugf("Container %s not found, skipping removal.", shortID)
return nil
@ -304,7 +303,7 @@ func (client dockerClient) doStartContainer(bg context.Context, c t.Container, c
name := c.Name()
log.Debugf("Starting container %s (%s)", name, t.ContainerID(creation.ID).ShortID())
err := client.api.ContainerStart(bg, creation.ID, types.ContainerStartOptions{})
err := client.api.ContainerStart(bg, creation.ID, container.StartOptions{})
if err != nil {
return err
}
@ -399,7 +398,7 @@ func (client dockerClient) PullImage(ctx context.Context, container t.Container)
defer response.Close()
// the pull request will be aborted prematurely unless the response is read
if _, err = ioutil.ReadAll(response); err != nil {
if _, err = io.ReadAll(response); err != nil {
log.Error(err)
return err
}
@ -412,7 +411,7 @@ func (client dockerClient) RemoveImageByID(id t.ImageID) error {
items, err := client.api.ImageRemove(
context.Background(),
string(id),
types.ImageRemoveOptions{
image.RemoveOptions{
Force: true,
})
@ -445,7 +444,7 @@ func (client dockerClient) ExecuteCommand(containerID t.ContainerID, command str
clog := log.WithField("containerID", containerID)
// Create the exec
execConfig := types.ExecConfig{
execConfig := container.ExecOptions{
Tty: true,
Detach: false,
Cmd: []string{"sh", "-c", command},
@ -456,7 +455,7 @@ func (client dockerClient) ExecuteCommand(containerID t.ContainerID, command str
return false, err
}
response, attachErr := client.api.ContainerExecAttach(bg, exec.ID, types.ExecStartCheck{
response, attachErr := client.api.ContainerExecAttach(bg, exec.ID, container.ExecStartOptions{
Tty: true,
Detach: false,
})
@ -465,7 +464,7 @@ func (client dockerClient) ExecuteCommand(containerID t.ContainerID, command str
}
// Run the exec
execStartCheck := types.ExecStartCheck{Detach: false, Tty: true}
execStartCheck := container.ExecStartOptions{Detach: false, Tty: true}
err = client.api.ContainerExecStart(bg, exec.ID, execStartCheck)
if err != nil {
return false, err