Skip to content

Commit 26d5aa9

Browse files
authored
Bump docker and Go deps (#739)
* Bump docker and Go deps Min Go 1.22 Requires newer Docker API versions on dockerd. * Let's not be _too_ new else it won't work with ubuntu:latest * Still too new. * Clarify API version in docs
1 parent ec56d1e commit 26d5aa9

File tree

5 files changed

+58
-19
lines changed

5 files changed

+58
-19
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ See also [Complement Crypto](https://github.com/matrix-org/complement-crypto) fo
99

1010
## Running
1111

12-
You need to have Go and Docker >= 20.10 installed. Then:
12+
You need to have Go and Docker installed. Complement uses Docker API version 1.45, so your `docker version` must support that. Then:
1313

1414
```
1515
$ COMPLEMENT_BASE_IMAGE=some-matrix/homeserver-impl go test -v ./tests/...

go.mod

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
module github.com/matrix-org/complement
22

3-
go 1.19
3+
go 1.22
4+
5+
toolchain go1.22.1
46

57
require (
6-
github.com/docker/docker v24.0.9+incompatible
8+
github.com/docker/docker v26.1.4+incompatible
79
github.com/docker/go-connections v0.4.0
810
github.com/gorilla/mux v1.8.0
911
github.com/matrix-org/gomatrix v0.0.0-20220926102614-ceba4d9f7530
@@ -21,20 +23,29 @@ require (
2123
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
2224
github.com/Microsoft/go-winio v0.5.2 // indirect
2325
github.com/ajstarks/svgo v0.0.0-20211024235047-1546f124cd8b // indirect
26+
github.com/distribution/reference v0.6.0 // indirect
2427
github.com/docker/distribution v2.8.2+incompatible // indirect
2528
github.com/docker/go-units v0.4.0 // indirect
29+
github.com/felixge/httpsnoop v1.0.4 // indirect
2630
github.com/go-fonts/liberation v0.2.0 // indirect
2731
github.com/go-latex/latex v0.0.0-20210823091927-c0d11ff05a81 // indirect
32+
github.com/go-logr/logr v1.4.2 // indirect
33+
github.com/go-logr/stdr v1.2.2 // indirect
2834
github.com/go-pdf/fpdf v0.6.0 // indirect
2935
github.com/gogo/protobuf v1.3.2 // indirect
3036
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect
37+
github.com/moby/docker-image-spec v1.3.1 // indirect
3138
github.com/moby/term v0.0.0-20210610120745-9d4ed1856297 // indirect
3239
github.com/morikuni/aec v1.0.0 // indirect
3340
github.com/opencontainers/go-digest v1.0.0 // indirect
3441
github.com/opencontainers/image-spec v1.0.3-0.20211202183452-c5a74bcca799 // indirect
3542
github.com/pkg/errors v0.9.1 // indirect
3643
github.com/tidwall/match v1.1.1 // indirect
3744
github.com/tidwall/pretty v1.2.1 // indirect
45+
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.55.0 // indirect
46+
go.opentelemetry.io/otel v1.30.0 // indirect
47+
go.opentelemetry.io/otel/metric v1.30.0 // indirect
48+
go.opentelemetry.io/otel/trace v1.30.0 // indirect
3849
golang.org/x/crypto v0.21.0 // indirect
3950
golang.org/x/image v0.18.0 // indirect
4051
golang.org/x/net v0.23.0 // indirect

go.sum

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,24 @@ github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ
1616
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
1717
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
1818
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
19+
github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5QvfrDyIgxBk=
20+
github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E=
1921
github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m322EBzniBPB6ZIzuh8=
2022
github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
2123
github.com/docker/docker v24.0.9+incompatible h1:HPGzNmwfLZWdxHqK9/II92pyi1EpYKsAqcl4G0Of9v0=
2224
github.com/docker/docker v24.0.9+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
25+
github.com/docker/docker v26.1.4+incompatible h1:vuTpXDuoga+Z38m1OZHzl7NKisKWaWlhjQk7IDPSLsU=
26+
github.com/docker/docker v26.1.4+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
27+
github.com/docker/docker v27.0.3+incompatible h1:aBGI9TeQ4MPlhquTQKq9XbK79rKFVwXNUAYz9aXyEBE=
28+
github.com/docker/docker v27.0.3+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
29+
github.com/docker/docker v27.3.1+incompatible h1:KttF0XoteNTicmUtBO0L2tP+J7FGRFTjaEF4k6WdhfI=
30+
github.com/docker/docker v27.3.1+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
2331
github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ=
2432
github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec=
2533
github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw=
2634
github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
35+
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
36+
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
2737
github.com/fogleman/gg v1.3.0/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k=
2838
github.com/go-fonts/dejavu v0.1.0 h1:JSajPXURYqpr+Cu8U9bt8K+XcACIHWqWrvWCKyeFmVQ=
2939
github.com/go-fonts/dejavu v0.1.0/go.mod h1:4Wt4I4OU2Nq9asgDCteaAaWZOV24E+0/Pwo0gppep4g=
@@ -34,6 +44,11 @@ github.com/go-fonts/liberation v0.2.0/go.mod h1:K6qoJYypsmfVjWg8KOVDQhLc8UDgIK2H
3444
github.com/go-fonts/stix v0.1.0/go.mod h1:w/c1f0ldAUlJmLBvlbkvVXLAD+tAMqobIIQpmnUIzUY=
3545
github.com/go-latex/latex v0.0.0-20210823091927-c0d11ff05a81 h1:6zl3BbBhdnMkpSj2YY30qV3gDcVBGtFgVsV3+/i+mKQ=
3646
github.com/go-latex/latex v0.0.0-20210823091927-c0d11ff05a81/go.mod h1:SX0U8uGpxhq9o2S/CELCSUxEWWAuoCUcVCQWv7G2OCk=
47+
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
48+
github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
49+
github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
50+
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
51+
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
3752
github.com/go-pdf/fpdf v0.5.0/go.mod h1:HzcnA+A23uwogo0tp9yU+l3V+KXhiESpt1PMayhOh5M=
3853
github.com/go-pdf/fpdf v0.6.0 h1:MlgtGIfsdMEEQJr2le6b/HNr1ZlQwxyWr77r2aj2U/8=
3954
github.com/go-pdf/fpdf v0.6.0/go.mod h1:HzcnA+A23uwogo0tp9yU+l3V+KXhiESpt1PMayhOh5M=
@@ -57,6 +72,8 @@ github.com/matrix-org/gomatrixserverlib v0.0.0-20230921171121-0466775328c7/go.mo
5772
github.com/matrix-org/util v0.0.0-20221111132719-399730281e66 h1:6z4KxomXSIGWqhHcfzExgkH3Z3UkIXry4ibJS4Aqz2Y=
5873
github.com/matrix-org/util v0.0.0-20221111132719-399730281e66/go.mod h1:iBI1foelCqA09JJgPV0FYz4qA5dUXYOxMi57FxKBdd4=
5974
github.com/miekg/dns v1.1.50 h1:DQUfb9uc6smULcREF09Uc+/Gd46YWqJd5DbpPE9xkcA=
75+
github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0=
76+
github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo=
6077
github.com/moby/term v0.0.0-20210610120745-9d4ed1856297 h1:yH0SvLzcbZxcJXho2yh7CqdENGMQe73Cw3woZBpPli0=
6178
github.com/moby/term v0.0.0-20210610120745-9d4ed1856297/go.mod h1:vgPCkQMyxTZ7IDy8SXRufE172gr8+K/JE/7hHFxHW3A=
6279
github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A=
@@ -83,6 +100,7 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
83100
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
84101
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
85102
github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
103+
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
86104
github.com/tidwall/gjson v1.14.2/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
87105
github.com/tidwall/gjson v1.16.0 h1:SyXa+dsSPpUlcwEDuKuEBJEz5vzTvOea+9rjyYodQFg=
88106
github.com/tidwall/gjson v1.16.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
@@ -95,6 +113,14 @@ github.com/tidwall/sjson v1.2.5 h1:kLy8mja+1c9jlljvWTlSazM7cKDRfJuR/bOJhcY5NcY=
95113
github.com/tidwall/sjson v1.2.5/go.mod h1:Fvgq9kS/6ociJEDnK0Fk1cpYF4FIW6ZF7LAe+6jwd28=
96114
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
97115
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
116+
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.55.0 h1:ZIg3ZT/aQ7AfKqdwp7ECpOK6vHqquXXuyTjIO8ZdmPs=
117+
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.55.0/go.mod h1:DQAwmETtZV00skUwgD6+0U89g80NKsJE3DCKeLLPQMI=
118+
go.opentelemetry.io/otel v1.30.0 h1:F2t8sK4qf1fAmY9ua4ohFS/K+FUuOPemHUIXHtktrts=
119+
go.opentelemetry.io/otel v1.30.0/go.mod h1:tFw4Br9b7fOS+uEao81PJjVMjW/5fvNCbpsDIXqP0pc=
120+
go.opentelemetry.io/otel/metric v1.30.0 h1:4xNulvn9gjzo4hjg+wzIKG7iNFEaBMX00Qd4QIZs7+w=
121+
go.opentelemetry.io/otel/metric v1.30.0/go.mod h1:aXTfST94tswhWEb+5QjlSqG+cZlmyXy/u8jFpor3WqQ=
122+
go.opentelemetry.io/otel/trace v1.30.0 h1:7UBkkYzeg3C7kQX8VAidWh2biiQbtAKjyIML8dQ9wmc=
123+
go.opentelemetry.io/otel/trace v1.30.0/go.mod h1:5EyKqTzzmyqB9bwtCCq6pDLktPK6fmGf/Dph+8VI02o=
98124
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
99125
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
100126
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=

internal/docker/builder.go

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222

2323
"github.com/docker/docker/api/types"
2424
"github.com/docker/docker/api/types/container"
25+
"github.com/docker/docker/api/types/image"
2526
"github.com/docker/docker/client"
2627
"github.com/docker/docker/pkg/stdcopy"
2728
"github.com/docker/go-connections/nat"
@@ -100,7 +101,7 @@ func (d *Builder) removeNetworks() error {
100101

101102
// removeImages removes all images with `complementLabel`.
102103
func (d *Builder) removeImages() error {
103-
images, err := d.Docker.ImageList(context.Background(), types.ImageListOptions{
104+
images, err := d.Docker.ImageList(context.Background(), image.ListOptions{
104105
Filters: label(
105106
complementLabel,
106107
"complement_pkg="+d.Config.PackageNamespace,
@@ -136,7 +137,7 @@ func (d *Builder) removeImages() error {
136137
d.log("Keeping image created from blueprint %s", bprintName)
137138
continue
138139
}
139-
_, err = d.Docker.ImageRemove(context.Background(), img.ID, types.ImageRemoveOptions{
140+
_, err = d.Docker.ImageRemove(context.Background(), img.ID, image.RemoveOptions{
140141
Force: true,
141142
})
142143
if err != nil {
@@ -149,7 +150,7 @@ func (d *Builder) removeImages() error {
149150

150151
// removeContainers removes all containers with `complementLabel`.
151152
func (d *Builder) removeContainers() error {
152-
containers, err := d.Docker.ContainerList(context.Background(), types.ContainerListOptions{
153+
containers, err := d.Docker.ContainerList(context.Background(), container.ListOptions{
153154
All: true,
154155
Filters: label(
155156
complementLabel,
@@ -160,7 +161,7 @@ func (d *Builder) removeContainers() error {
160161
return err
161162
}
162163
for _, c := range containers {
163-
err = d.Docker.ContainerRemove(context.Background(), c.ID, types.ContainerRemoveOptions{
164+
err = d.Docker.ContainerRemove(context.Background(), c.ID, container.RemoveOptions{
164165
Force: true,
165166
})
166167
if err != nil {
@@ -171,7 +172,7 @@ func (d *Builder) removeContainers() error {
171172
}
172173

173174
func (d *Builder) ConstructBlueprintIfNotExist(bprint b.Blueprint) error {
174-
images, err := d.Docker.ImageList(context.Background(), types.ImageListOptions{
175+
images, err := d.Docker.ImageList(context.Background(), image.ListOptions{
175176
Filters: label(
176177
"complement_blueprint="+bprint.Name,
177178
"complement_pkg="+d.Config.PackageNamespace,
@@ -200,12 +201,12 @@ func (d *Builder) ConstructBlueprint(bprint b.Blueprint) error {
200201

201202
// wait a bit for images/containers to show up in 'image ls'
202203
foundImages := false
203-
var images []types.ImageSummary
204+
var images []image.Summary
204205
var err error
205206
waitTime := 5 * time.Second
206207
startTime := time.Now()
207208
for time.Since(startTime) < waitTime {
208-
images, err = d.Docker.ImageList(context.Background(), types.ImageListOptions{
209+
images, err = d.Docker.ImageList(context.Background(), image.ListOptions{
209210
Filters: label(
210211
complementLabel,
211212
"complement_blueprint="+bprint.Name,
@@ -255,7 +256,7 @@ func (d *Builder) construct(bprint b.Blueprint) (errs []error) {
255256
// something went wrong, but we have a container which may have interesting logs
256257
printLogs(d.Docker, res.containerID, res.contextStr)
257258
}
258-
if delErr := d.Docker.ContainerRemove(context.Background(), res.containerID, types.ContainerRemoveOptions{
259+
if delErr := d.Docker.ContainerRemove(context.Background(), res.containerID, container.RemoveOptions{
259260
Force: true,
260261
}); delErr != nil {
261262
d.log("%s: failed to remove container which failed to deploy: %s", res.contextStr, delErr)
@@ -334,7 +335,7 @@ func (d *Builder) construct(bprint b.Blueprint) (errs []error) {
334335
d.log("%s: Stopped container: %s", res.contextStr, res.containerID)
335336

336337
// commit the container
337-
commit, err := d.Docker.ContainerCommit(context.Background(), res.containerID, types.ContainerCommitOptions{
338+
commit, err := d.Docker.ContainerCommit(context.Background(), res.containerID, container.CommitOptions{
338339
Author: "Complement",
339340
Pause: true,
340341
Reference: "localhost/complement:" + res.contextStr,
@@ -475,7 +476,7 @@ func createNetworkIfNotExists(docker *client.Client, pkgNamespace, blueprintName
475476
}
476477

477478
func printLogs(docker *client.Client, containerID, contextStr string) {
478-
reader, err := docker.ContainerLogs(context.Background(), containerID, types.ContainerLogsOptions{
479+
reader, err := docker.ContainerLogs(context.Background(), containerID, container.LogsOptions{
479480
ShowStderr: true,
480481
ShowStdout: true,
481482
Follow: false,

internal/docker/deployer.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import (
3636

3737
"github.com/docker/docker/api/types"
3838
"github.com/docker/docker/api/types/container"
39+
"github.com/docker/docker/api/types/image"
3940
"github.com/docker/docker/api/types/mount"
4041
"github.com/docker/docker/api/types/network"
4142

@@ -131,7 +132,7 @@ func (d *Deployer) Deploy(ctx context.Context, blueprintName string) (*Deploymen
131132
HS: make(map[string]*HomeserverDeployment),
132133
Config: d.config,
133134
}
134-
images, err := d.Docker.ImageList(ctx, types.ImageListOptions{
135+
images, err := d.Docker.ImageList(ctx, image.ListOptions{
135136
Filters: label(
136137
"complement_pkg="+d.config.PackageNamespace,
137138
"complement_blueprint="+blueprintName,
@@ -152,7 +153,7 @@ func (d *Deployer) Deploy(ctx context.Context, blueprintName string) (*Deploymen
152153
var mu sync.Mutex // protects mutable values like the counter and errors
153154
var wg sync.WaitGroup
154155
wg.Add(len(images)) // ensure we wait until all images have deployed
155-
deployImg := func(img types.ImageSummary) error {
156+
deployImg := func(img image.Summary) error {
156157
defer wg.Done()
157158
mu.Lock()
158159
d.Counter++
@@ -183,7 +184,7 @@ func (d *Deployer) Deploy(ctx context.Context, blueprintName string) (*Deploymen
183184

184185
var lastErr error
185186
for _, img := range images {
186-
go func(i types.ImageSummary) {
187+
go func(i image.Summary) {
187188
err := deployImg(i)
188189
if err != nil {
189190
mu.Lock()
@@ -232,7 +233,7 @@ func (d *Deployer) Destroy(dep *Deployment, printServerLogs bool, testName strin
232233
log.Printf("Post test script result: %s", string(result))
233234
}
234235

235-
err = d.Docker.ContainerRemove(context.Background(), hsDep.ContainerID, types.ContainerRemoveOptions{
236+
err = d.Docker.ContainerRemove(context.Background(), hsDep.ContainerID, container.RemoveOptions{
236237
Force: true,
237238
})
238239
if err != nil {
@@ -293,7 +294,7 @@ func (d *Deployer) Restart(hsDep *HomeserverDeployment) error {
293294

294295
func (d *Deployer) StartServer(hsDep *HomeserverDeployment) error {
295296
ctx := context.Background()
296-
err := d.Docker.ContainerStart(ctx, hsDep.ContainerID, types.ContainerStartOptions{})
297+
err := d.Docker.ContainerStart(ctx, hsDep.ContainerID, container.StartOptions{})
297298
if err != nil {
298299
return fmt.Errorf("failed to start container %s: %s", hsDep.ContainerID, err)
299300
}
@@ -431,7 +432,7 @@ func deployImage(
431432
return stubDeployment, fmt.Errorf("failed to copy CA key to container: %s", err)
432433
}
433434

434-
err = docker.ContainerStart(ctx, containerID, types.ContainerStartOptions{})
435+
err = docker.ContainerStart(ctx, containerID, container.StartOptions{})
435436
if err != nil {
436437
return stubDeployment, err
437438
}

0 commit comments

Comments
 (0)