Skip to content

Commit 988b038

Browse files
chore: bump dependencies (#154)
Updates: - Go: 1.24.1 → 1.24.10 - github.com/coder/coder/v2: 2.14.4 → 2.23.0 - github.com/docker/docker: 27.3.1 → 28.1.1 (fixes Docker v28 API breaking changes) - github.com/go-viper/mapstructure/v2: 2.3.0 → 2.4.0 - github.com/opencontainers/runc: 1.1.14 → 1.2.8 - github.com/coder/tailscale: updated to match coder/coder v2.23.0 - golang.org/x/oauth2: 0.23.0 → 0.29.0 (already newer than target) Breaking changes fixed: - Updated Docker API types for v28 compatibility - Migrated deprecated types to new subpackages (image, container, common) - Updated function signatures for new Docker client options (ImageHistory, ImageLoad, ImageSave) - Fixed ExecStartCheck → ExecAttachOptions, ExecConfig → ExecOptions - Fixed ImagesPruneReport → image.PruneReport - Fixed ContainerExecInspect → container.ExecInspect --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1 parent cc87205 commit 988b038

File tree

7 files changed

+904
-507
lines changed

7 files changed

+904
-507
lines changed

cli/clitest/fake.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"strings"
99

1010
dockertypes "github.com/docker/docker/api/types"
11+
containertypes "github.com/docker/docker/api/types/container"
1112
testingexec "k8s.io/utils/exec/testing"
1213

1314
"github.com/coder/envbox/dockerutil"
@@ -43,7 +44,7 @@ func NewFakeDockerClient() dockerutil.Client {
4344
}, nil
4445
}
4546

46-
client.ContainerExecAttachFn = func(_ context.Context, _ string, _ dockertypes.ExecStartCheck) (dockertypes.HijackedResponse, error) {
47+
client.ContainerExecAttachFn = func(_ context.Context, _ string, _ containertypes.ExecAttachOptions) (dockertypes.HijackedResponse, error) {
4748
return dockertypes.HijackedResponse{
4849
Reader: bufio.NewReader(strings.NewReader("root:x:0:0:root:/root:/bin/bash")),
4950
Conn: &net.IPConn{},

cli/docker_test.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
"testing"
1515

1616
dockertypes "github.com/docker/docker/api/types"
17+
"github.com/docker/docker/api/types/common"
1718
"github.com/docker/docker/api/types/container"
1819
"github.com/docker/docker/api/types/image"
1920
"github.com/docker/docker/api/types/network"
@@ -311,7 +312,7 @@ func TestDocker(t *testing.T) {
311312

312313
// Set the exec response from inspecting the image to some ID
313314
// greater than 0.
314-
client.ContainerExecAttachFn = func(_ context.Context, _ string, _ dockertypes.ExecStartCheck) (dockertypes.HijackedResponse, error) {
315+
client.ContainerExecAttachFn = func(_ context.Context, _ string, _ container.ExecAttachOptions) (dockertypes.HijackedResponse, error) {
315316
return dockertypes.HijackedResponse{
316317
Reader: bufio.NewReader(strings.NewReader("root:x:1001:1001:root:/root:/bin/bash")),
317318
Conn: &net.IPConn{},
@@ -444,23 +445,23 @@ func TestDocker(t *testing.T) {
444445
statExecID = "hi"
445446
)
446447

447-
client.ContainerExecCreateFn = func(_ context.Context, _ string, config dockertypes.ExecConfig) (dockertypes.IDResponse, error) {
448+
client.ContainerExecCreateFn = func(_ context.Context, _ string, config container.ExecOptions) (common.IDResponse, error) {
448449
if config.Cmd[0] == "stat" {
449-
return dockertypes.IDResponse{
450+
return common.IDResponse{
450451
ID: statExecID,
451452
}, nil
452453
}
453-
return dockertypes.IDResponse{}, nil
454+
return common.IDResponse{}, nil
454455
}
455456

456457
// Set the exec response from inspecting the image to some ID
457458
// greater than 0.
458-
client.ContainerExecInspectFn = func(_ context.Context, execID string) (dockertypes.ContainerExecInspect, error) {
459+
client.ContainerExecInspectFn = func(_ context.Context, execID string) (container.ExecInspect, error) {
459460
if execID == statExecID {
460-
return dockertypes.ContainerExecInspect{ExitCode: 1}, nil
461+
return container.ExecInspect{ExitCode: 1}, nil
461462
}
462463

463-
return dockertypes.ContainerExecInspect{}, nil
464+
return container.ExecInspect{}, nil
464465
}
465466

466467
var called bool

dockerutil/dockerfake/client.go

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@ import (
66
"strings"
77

88
dockertypes "github.com/docker/docker/api/types"
9+
"github.com/docker/docker/api/types/common"
910
containertypes "github.com/docker/docker/api/types/container"
1011
"github.com/docker/docker/api/types/events"
1112
"github.com/docker/docker/api/types/filters"
1213
"github.com/docker/docker/api/types/image"
1314
networktypes "github.com/docker/docker/api/types/network"
1415
"github.com/docker/docker/api/types/registry"
1516
"github.com/docker/docker/api/types/system"
17+
dockerclient "github.com/docker/docker/client"
1618
specs "github.com/opencontainers/image-spec/specs-go/v1"
1719

1820
"github.com/coder/envbox/dockerutil"
@@ -24,12 +26,12 @@ var _ dockerutil.Client = MockClient{}
2426
type MockClient struct {
2527
ImagePullFn func(_ context.Context, ref string, options image.PullOptions) (io.ReadCloser, error)
2628
ContainerCreateFn func(_ context.Context, config *containertypes.Config, hostConfig *containertypes.HostConfig, networkingConfig *networktypes.NetworkingConfig, _ *specs.Platform, containerName string) (containertypes.CreateResponse, error)
27-
ImagePruneFn func(_ context.Context, pruneFilter filters.Args) (dockertypes.ImagesPruneReport, error)
29+
ImagePruneFn func(_ context.Context, pruneFilter filters.Args) (image.PruneReport, error)
2830
ContainerStartFn func(_ context.Context, container string, options containertypes.StartOptions) error
29-
ContainerExecAttachFn func(_ context.Context, execID string, config dockertypes.ExecStartCheck) (dockertypes.HijackedResponse, error)
30-
ContainerExecCreateFn func(_ context.Context, container string, config dockertypes.ExecConfig) (dockertypes.IDResponse, error)
31-
ContainerExecStartFn func(_ context.Context, execID string, config dockertypes.ExecStartCheck) error
32-
ContainerExecInspectFn func(_ context.Context, execID string) (dockertypes.ContainerExecInspect, error)
31+
ContainerExecAttachFn func(_ context.Context, execID string, config containertypes.ExecAttachOptions) (dockertypes.HijackedResponse, error)
32+
ContainerExecCreateFn func(_ context.Context, container string, config containertypes.ExecOptions) (common.IDResponse, error)
33+
ContainerExecStartFn func(_ context.Context, execID string, config containertypes.ExecAttachOptions) error
34+
ContainerExecInspectFn func(_ context.Context, execID string) (containertypes.ExecInspect, error)
3335
ContainerInspectFn func(_ context.Context, container string) (dockertypes.ContainerJSON, error)
3436
ContainerRemoveFn func(_ context.Context, container string, options containertypes.RemoveOptions) error
3537
PingFn func(_ context.Context) (dockertypes.Ping, error)
@@ -51,23 +53,27 @@ func (MockClient) ImageCreate(_ context.Context, _ string, _ image.CreateOptions
5153
panic("not implemented")
5254
}
5355

54-
func (MockClient) ImageHistory(_ context.Context, _ string) ([]image.HistoryResponseItem, error) {
56+
func (MockClient) ImageHistory(_ context.Context, _ string, _ ...dockerclient.ImageHistoryOption) ([]image.HistoryResponseItem, error) {
5557
panic("not implemented")
5658
}
5759

5860
func (MockClient) ImageImport(_ context.Context, _ image.ImportSource, _ string, _ image.ImportOptions) (io.ReadCloser, error) {
5961
panic("not implemented")
6062
}
6163

62-
func (MockClient) ImageInspectWithRaw(_ context.Context, _ string) (dockertypes.ImageInspect, []byte, error) {
64+
func (MockClient) ImageInspect(_ context.Context, _ string, _ ...dockerclient.ImageInspectOption) (image.InspectResponse, error) {
65+
panic("not implemented")
66+
}
67+
68+
func (MockClient) ImageInspectWithRaw(_ context.Context, _ string) (image.InspectResponse, []byte, error) {
6369
panic("not implemented")
6470
}
6571

6672
func (MockClient) ImageList(_ context.Context, _ image.ListOptions) ([]image.Summary, error) {
6773
panic("not implemented")
6874
}
6975

70-
func (MockClient) ImageLoad(_ context.Context, _ io.Reader, _ bool) (dockertypes.ImageLoadResponse, error) {
76+
func (MockClient) ImageLoad(_ context.Context, _ io.Reader, _ ...dockerclient.ImageLoadOption) (image.LoadResponse, error) {
7177
panic("not implemented")
7278
}
7379

@@ -86,26 +92,26 @@ func (MockClient) ImageRemove(_ context.Context, _ string, _ image.RemoveOptions
8692
panic("not implemented")
8793
}
8894

89-
func (MockClient) ImageSearch(_ context.Context, _ string, _ dockertypes.ImageSearchOptions) ([]registry.SearchResult, error) {
95+
func (MockClient) ImageSearch(_ context.Context, _ string, _ registry.SearchOptions) ([]registry.SearchResult, error) {
9096
panic("not implemented")
9197
}
9298

93-
func (MockClient) ImageSave(_ context.Context, _ []string) (io.ReadCloser, error) {
99+
func (MockClient) ImageSave(_ context.Context, _ []string, _ ...dockerclient.ImageSaveOption) (io.ReadCloser, error) {
94100
panic("not implemented")
95101
}
96102

97103
func (MockClient) ImageTag(_ context.Context, _ string, _ string) error {
98104
panic("not implemented")
99105
}
100106

101-
func (m MockClient) ImagesPrune(ctx context.Context, pruneFilter filters.Args) (dockertypes.ImagesPruneReport, error) {
107+
func (m MockClient) ImagesPrune(ctx context.Context, pruneFilter filters.Args) (image.PruneReport, error) {
102108
if m.ImagePruneFn == nil {
103-
return dockertypes.ImagesPruneReport{}, nil
109+
return image.PruneReport{}, nil
104110
}
105111
return m.ImagePruneFn(ctx, pruneFilter)
106112
}
107113

108-
func (MockClient) Events(_ context.Context, _ dockertypes.EventsOptions) (<-chan events.Message, <-chan error) {
114+
func (MockClient) Events(_ context.Context, _ events.ListOptions) (<-chan events.Message, <-chan error) {
109115
panic("not implemented")
110116
}
111117

@@ -147,23 +153,23 @@ func (MockClient) ContainerDiff(_ context.Context, _ string) ([]containertypes.F
147153
panic("not implemented")
148154
}
149155

150-
func (m MockClient) ContainerExecAttach(ctx context.Context, execID string, config dockertypes.ExecStartCheck) (dockertypes.HijackedResponse, error) {
156+
func (m MockClient) ContainerExecAttach(ctx context.Context, execID string, config containertypes.ExecAttachOptions) (dockertypes.HijackedResponse, error) {
151157
if m.ContainerExecAttachFn == nil {
152158
return dockertypes.HijackedResponse{}, nil
153159
}
154160
return m.ContainerExecAttachFn(ctx, execID, config)
155161
}
156162

157-
func (m MockClient) ContainerExecCreate(ctx context.Context, name string, config dockertypes.ExecConfig) (dockertypes.IDResponse, error) {
163+
func (m MockClient) ContainerExecCreate(ctx context.Context, name string, config containertypes.ExecOptions) (common.IDResponse, error) {
158164
if m.ContainerExecCreateFn == nil {
159-
return dockertypes.IDResponse{}, nil
165+
return common.IDResponse{}, nil
160166
}
161167
return m.ContainerExecCreateFn(ctx, name, config)
162168
}
163169

164-
func (m MockClient) ContainerExecInspect(ctx context.Context, id string) (dockertypes.ContainerExecInspect, error) {
170+
func (m MockClient) ContainerExecInspect(ctx context.Context, id string) (containertypes.ExecInspect, error) {
165171
if m.ContainerExecInspectFn == nil {
166-
return dockertypes.ContainerExecInspect{
172+
return containertypes.ExecInspect{
167173
Pid: 123,
168174
}, nil
169175
}
@@ -175,7 +181,7 @@ func (MockClient) ContainerExecResize(_ context.Context, _ string, _ containerty
175181
panic("not implemented")
176182
}
177183

178-
func (m MockClient) ContainerExecStart(ctx context.Context, execID string, config dockertypes.ExecStartCheck) error {
184+
func (m MockClient) ContainerExecStart(ctx context.Context, execID string, config containertypes.ExecAttachOptions) error {
179185
if m.ContainerExecStartFn == nil {
180186
return nil
181187
}
@@ -201,7 +207,7 @@ func (MockClient) ContainerKill(_ context.Context, _ string, _ string) error {
201207
panic("not implemented")
202208
}
203209

204-
func (MockClient) ContainerList(_ context.Context, _ containertypes.ListOptions) ([]dockertypes.Container, error) {
210+
func (MockClient) ContainerList(_ context.Context, _ containertypes.ListOptions) ([]containertypes.Summary, error) {
205211
panic("not implemented")
206212
}
207213

@@ -232,11 +238,11 @@ func (MockClient) ContainerRestart(_ context.Context, _ string, _ containertypes
232238
panic("not implemented")
233239
}
234240

235-
func (MockClient) ContainerStatPath(_ context.Context, _ string, _ string) (dockertypes.ContainerPathStat, error) {
241+
func (MockClient) ContainerStatPath(_ context.Context, _ string, _ string) (containertypes.PathStat, error) {
236242
panic("not implemented")
237243
}
238244

239-
func (MockClient) ContainerStats(_ context.Context, _ string, _ bool) (dockertypes.ContainerStats, error) {
245+
func (MockClient) ContainerStats(_ context.Context, _ string, _ bool) (containertypes.StatsResponseReader, error) {
240246
panic("not implemented")
241247
}
242248

@@ -267,18 +273,18 @@ func (MockClient) ContainerWait(_ context.Context, _ string, _ containertypes.Wa
267273
panic("not implemented")
268274
}
269275

270-
func (MockClient) CopyFromContainer(_ context.Context, _ string, _ string) (io.ReadCloser, dockertypes.ContainerPathStat, error) {
276+
func (MockClient) CopyFromContainer(_ context.Context, _ string, _ string) (io.ReadCloser, containertypes.PathStat, error) {
271277
panic("not implemented")
272278
}
273279

274-
func (MockClient) CopyToContainer(_ context.Context, _ string, _ string, _ io.Reader, _ dockertypes.CopyToContainerOptions) error {
280+
func (MockClient) CopyToContainer(_ context.Context, _ string, _ string, _ io.Reader, _ containertypes.CopyToContainerOptions) error {
275281
panic("not implemented")
276282
}
277283

278-
func (MockClient) ContainersPrune(_ context.Context, _ filters.Args) (dockertypes.ContainersPruneReport, error) {
284+
func (MockClient) ContainersPrune(_ context.Context, _ filters.Args) (containertypes.PruneReport, error) {
279285
panic("not implemented")
280286
}
281287

282-
func (MockClient) ContainerStatsOneShot(_ context.Context, _ string) (dockertypes.ContainerStats, error) {
288+
func (MockClient) ContainerStatsOneShot(_ context.Context, _ string) (containertypes.StatsResponseReader, error) {
283289
panic("not implemented")
284290
}

dockerutil/exec.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"io"
77
"time"
88

9-
dockertypes "github.com/docker/docker/api/types"
109
"github.com/docker/docker/api/types/container"
1110
"golang.org/x/xerrors"
1211

@@ -41,7 +40,7 @@ func ExecContainer(ctx context.Context, client Client, config ExecConfig) ([]byt
4140
return nil, xerrors.Errorf("exec create: %w", err)
4241
}
4342

44-
resp, err := client.ContainerExecAttach(ctx, exec.ID, dockertypes.ExecStartCheck{})
43+
resp, err := client.ContainerExecAttach(ctx, exec.ID, container.ExecAttachOptions{})
4544
if err != nil {
4645
return nil, xerrors.Errorf("attach to exec: %w", err)
4746
}

dockerutil/image.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99
"strings"
1010
"time"
1111

12-
dockertypes "github.com/docker/docker/api/types"
1312
"github.com/docker/docker/api/types/container"
1413
"github.com/docker/docker/api/types/filters"
1514
"github.com/docker/docker/api/types/image"
@@ -126,12 +125,12 @@ func PullImage(ctx context.Context, config *PullImageConfig) error {
126125
}
127126

128127
// PruneImage runs a simple 'docker prune'.
129-
func PruneImages(ctx context.Context, client Client) (dockertypes.ImagesPruneReport, error) {
128+
func PruneImages(ctx context.Context, client Client) (image.PruneReport, error) {
130129
report, err := client.ImagesPrune(ctx,
131130
filters.NewArgs(filters.Arg("dangling", "false")),
132131
)
133132
if err != nil {
134-
return dockertypes.ImagesPruneReport{}, xerrors.Errorf("images prune: %w", err)
133+
return image.PruneReport{}, xerrors.Errorf("images prune: %w", err)
135134
}
136135

137136
return report, nil

0 commit comments

Comments
 (0)