Skip to content

Commit 54d8012

Browse files
committed
chore(deps): consolidate dependabot updates and bump Go to 1.24.10
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
1 parent f275115 commit 54d8012

File tree

7 files changed

+58
-106
lines changed

7 files changed

+58
-106
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

go.mod

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
module github.com/coder/envbox
22

3-
go 1.24.2
3+
go 1.24.10
44

55
// There are a few minor changes we make to Tailscale that we're slowly upstreaming. Compare here:
66
// https://github.com/tailscale/tailscale/compare/main...coder:tailscale:main
7-
replace tailscale.com => github.com/coder/tailscale v1.1.1-0.20240702054557-aa558fbe5374
7+
replace tailscale.com => github.com/coder/tailscale v1.1.1-0.20250422090654-5090e715905e
88

99
replace github.com/gliderlabs/ssh => github.com/coder/ssh v0.0.0-20231128192721-70855dedb788
1010

@@ -121,7 +121,7 @@ require (
121121
github.com/go-playground/locales v0.14.1 // indirect
122122
github.com/go-playground/universal-translator v0.18.1 // indirect
123123
github.com/go-playground/validator/v10 v10.26.0 // indirect
124-
github.com/go-viper/mapstructure/v2 v2.3.0 // indirect
124+
github.com/go-viper/mapstructure/v2 v2.4.0 // indirect
125125
github.com/gobwas/glob v0.2.3 // indirect
126126
github.com/godbus/dbus/v5 v5.1.0 // indirect
127127
github.com/gogo/protobuf v1.3.2 // indirect
@@ -194,7 +194,7 @@ require (
194194
github.com/open-policy-agent/opa v1.4.2 // indirect
195195
github.com/openai/openai-go v0.1.0-beta.10 // indirect
196196
github.com/opencontainers/go-digest v1.0.0 // indirect
197-
github.com/opencontainers/runc v1.2.3 // indirect
197+
github.com/opencontainers/runc v1.2.8 // indirect
198198
github.com/outcaste-io/ristretto v0.2.3 // indirect
199199
github.com/philhofer/fwd v1.1.3-0.20240916144458-20a13a1f6b7c // indirect
200200
github.com/pierrec/lz4/v4 v4.1.18 // indirect
@@ -222,6 +222,7 @@ require (
222222
github.com/tailscale/golang-x-crypto v0.0.0-20230713185742-f0b76a10a08e // indirect
223223
github.com/tailscale/goupnp v1.0.1-0.20210804011211-c64d0f06ea05 // indirect
224224
github.com/tailscale/netlink v1.1.1-0.20211101221916-cabfb018fe85 // indirect
225+
github.com/tailscale/peercred v0.0.0-20250107143737-35a0c7bd7edc // indirect
225226
github.com/tailscale/wireguard-go v0.0.0-20231121184858-cc193a0b3272 // indirect
226227
github.com/tchap/go-patricia/v2 v2.3.2 // indirect
227228
github.com/tcnksm/go-httpstat v0.2.0 // indirect
@@ -285,9 +286,7 @@ require (
285286
gopkg.in/ini.v1 v1.67.0 // indirect
286287
gopkg.in/yaml.v3 v3.0.1 // indirect
287288
gvisor.dev/gvisor v0.0.0-20240509041132-65b30f7869dc // indirect
288-
inet.af/peercred v0.0.0-20210906144145-0893ea02156a // indirect
289289
k8s.io/klog/v2 v2.130.1 // indirect
290-
nhooyr.io/websocket v1.8.7 // indirect
291290
sigs.k8s.io/yaml v1.4.0 // indirect
292291
tailscale.com v1.80.3 // indirect
293292
)

0 commit comments

Comments
 (0)