mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-09-01 18:24:03 +00:00
Update docker to v27 (#3972)
This commit is contained in:
@@ -22,8 +22,10 @@ import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/api/types/image"
|
||||
"github.com/docker/docker/api/types/network"
|
||||
"github.com/docker/docker/api/types/system"
|
||||
"github.com/docker/docker/api/types/volume"
|
||||
tls_config "github.com/docker/go-connections/tlsconfig"
|
||||
"github.com/moby/moby/client"
|
||||
@@ -42,7 +44,7 @@ type docker struct {
|
||||
enableIPv6 bool
|
||||
network string
|
||||
volumes []string
|
||||
info types.Info
|
||||
info system.Info
|
||||
}
|
||||
|
||||
const (
|
||||
@@ -171,9 +173,9 @@ func (e *docker) SetupWorkflow(ctx context.Context, conf *backend.Config, taskUU
|
||||
networkDriver = networkDriverNAT
|
||||
}
|
||||
for _, n := range conf.Networks {
|
||||
_, err := e.client.NetworkCreate(ctx, n.Name, types.NetworkCreate{
|
||||
_, err := e.client.NetworkCreate(ctx, n.Name, network.CreateOptions{
|
||||
Driver: networkDriver,
|
||||
EnableIPv6: e.enableIPv6,
|
||||
EnableIPv6: &e.enableIPv6,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -190,7 +192,7 @@ func (e *docker) StartStep(ctx context.Context, step *backend.Step, taskUUID str
|
||||
containerName := toContainerName(step)
|
||||
|
||||
// create pull options with encoded authorization credentials.
|
||||
pullOpts := types.ImagePullOptions{}
|
||||
pullOpts := image.PullOptions{}
|
||||
if step.AuthConfig.Username != "" && step.AuthConfig.Password != "" {
|
||||
pullOpts.RegistryAuth, _ = encodeAuthToBase64(step.AuthConfig)
|
||||
}
|
||||
@@ -257,7 +259,7 @@ func (e *docker) StartStep(ctx context.Context, step *backend.Step, taskUUID str
|
||||
}
|
||||
}
|
||||
|
||||
return e.client.ContainerStart(ctx, containerName, types.ContainerStartOptions{})
|
||||
return e.client.ContainerStart(ctx, containerName, container.StartOptions{})
|
||||
}
|
||||
|
||||
func (e *docker) WaitStep(ctx context.Context, step *backend.Step, taskUUID string) (*backend.State, error) {
|
||||
@@ -286,7 +288,7 @@ func (e *docker) WaitStep(ctx context.Context, step *backend.Step, taskUUID stri
|
||||
func (e *docker) TailStep(ctx context.Context, step *backend.Step, taskUUID string) (io.ReadCloser, error) {
|
||||
log.Trace().Str("taskUUID", taskUUID).Msgf("tail logs of step %s", step.Name)
|
||||
|
||||
logs, err := e.client.ContainerLogs(ctx, toContainerName(step), types.ContainerLogsOptions{
|
||||
logs, err := e.client.ContainerLogs(ctx, toContainerName(step), container.LogsOptions{
|
||||
Follow: true,
|
||||
ShowStdout: true,
|
||||
ShowStderr: true,
|
||||
@@ -350,7 +352,7 @@ func (e *docker) DestroyWorkflow(ctx context.Context, conf *backend.Config, task
|
||||
return nil
|
||||
}
|
||||
|
||||
var removeOpts = types.ContainerRemoveOptions{
|
||||
var removeOpts = container.RemoveOptions{
|
||||
RemoveVolumes: true,
|
||||
RemoveLinks: false,
|
||||
Force: false,
|
||||
|
Reference in New Issue
Block a user