Skip to content

Commit 7c19c27

Browse files
authored
Merge pull request #291 from jericop/update-docker-go-containerregistry
Update docker and go-containerregistry
2 parents f0ef71e + b579406 commit 7c19c27

File tree

8 files changed

+118
-123
lines changed

8 files changed

+118
-123
lines changed

acceptance/reproducibility_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ func testReproducibility(t *testing.T, _ spec.G, it spec.S) {
131131
img2, err := local.NewImage(imageName2, dockerClient, local.FromBaseImage(runnableBaseImageName))
132132
h.AssertNil(t, err)
133133
mutateAndSave(t, img2)
134+
134135
h.PushImage(t, dockerClient, imageName2)
135136

136137
compare(t, imageName1, imageName2)
@@ -170,6 +171,10 @@ func compare(t *testing.T, img1, img2 string) {
170171
cfg1.Config.Image = ""
171172
cfg2.Config.Image = ""
172173

174+
// ArgsEscaped is deprecated by docker/moby and is no longer set by imgutil, so we set it to false
175+
cfg1.Config.ArgsEscaped = false
176+
cfg2.Config.ArgsEscaped = false
177+
173178
h.AssertEq(t, cfg1, cfg2)
174179

175180
h.AssertEq(t, ref1.Identifier(), ref2.Identifier())

go.mod

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,53 @@
11
module github.com/buildpacks/imgutil
22

33
require (
4-
github.com/docker/docker v28.1.1+incompatible
4+
github.com/containerd/errdefs v1.0.0
5+
github.com/docker/docker v28.3.0+incompatible
56
github.com/google/go-cmp v0.7.0
6-
github.com/google/go-containerregistry v0.19.1
7+
github.com/google/go-containerregistry v0.20.6
8+
github.com/moby/docker-image-spec v1.3.1
79
github.com/pkg/errors v0.9.1
810
github.com/sclevine/spec v1.4.0
9-
golang.org/x/sync v0.7.0
11+
golang.org/x/sync v0.15.0
1012
)
1113

1214
require (
1315
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect
14-
github.com/Microsoft/go-winio v0.6.1 // indirect
15-
github.com/containerd/log v0.1.0 // indirect
16-
github.com/containerd/stargz-snapshotter/estargz v0.14.3 // indirect
16+
github.com/Microsoft/go-winio v0.6.2 // indirect
17+
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
18+
github.com/containerd/errdefs/pkg v0.3.0 // indirect
19+
github.com/containerd/stargz-snapshotter/estargz v0.16.3 // indirect
1720
github.com/distribution/reference v0.6.0 // indirect
18-
github.com/docker/cli v28.1.1+incompatible // indirect
19-
github.com/docker/distribution v2.8.2+incompatible // indirect
20-
github.com/docker/docker-credential-helpers v0.7.0 // indirect
21-
github.com/docker/go-connections v0.4.0 // indirect
21+
github.com/docker/cli v28.2.2+incompatible // indirect
22+
github.com/docker/distribution v2.8.3+incompatible // indirect
23+
github.com/docker/docker-credential-helpers v0.9.3 // indirect
24+
github.com/docker/go-connections v0.5.0 // indirect
2225
github.com/docker/go-units v0.5.0 // indirect
2326
github.com/felixge/httpsnoop v1.0.4 // indirect
24-
github.com/go-logr/logr v1.4.2 // indirect
27+
github.com/go-logr/logr v1.4.3 // indirect
2528
github.com/go-logr/stdr v1.2.2 // indirect
2629
github.com/gogo/protobuf v1.3.2 // indirect
27-
github.com/klauspost/compress v1.16.5 // indirect
30+
github.com/klauspost/compress v1.18.0 // indirect
2831
github.com/mitchellh/go-homedir v1.1.0 // indirect
29-
github.com/moby/docker-image-spec v1.3.1 // indirect
30-
github.com/moby/sys/atomicwriter v0.1.0 // indirect
32+
github.com/moby/sys/sequential v0.6.0 // indirect
3133
github.com/moby/term v0.5.0 // indirect
3234
github.com/morikuni/aec v1.0.0 // indirect
3335
github.com/opencontainers/go-digest v1.0.0 // indirect
34-
github.com/opencontainers/image-spec v1.1.0-rc3 // indirect
36+
github.com/opencontainers/image-spec v1.1.1 // indirect
3537
github.com/sirupsen/logrus v1.9.3 // indirect
36-
github.com/vbatts/tar-split v0.11.3 // indirect
38+
github.com/vbatts/tar-split v0.12.1 // indirect
3739
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
38-
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.50.0 // indirect
40+
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.61.0 // indirect
3941
go.opentelemetry.io/otel v1.36.0 // indirect
40-
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.25.0 // indirect
42+
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.33.0 // indirect
4143
go.opentelemetry.io/otel/metric v1.36.0 // indirect
42-
go.opentelemetry.io/otel/sdk v1.25.0 // indirect
4344
go.opentelemetry.io/otel/trace v1.36.0 // indirect
44-
golang.org/x/mod v0.10.0 // indirect
45-
golang.org/x/net v0.23.0 // indirect
46-
golang.org/x/sys v0.18.0 // indirect
47-
golang.org/x/tools v0.9.1 // indirect
45+
go.opentelemetry.io/proto/otlp v1.4.0 // indirect
46+
golang.org/x/net v0.41.0 // indirect
47+
golang.org/x/sys v0.33.0 // indirect
48+
google.golang.org/genproto/googleapis/api v0.0.0-20241209162323-e6fa225c2576 // indirect
49+
google.golang.org/genproto/googleapis/rpc v0.0.0-20241209162323-e6fa225c2576 // indirect
50+
google.golang.org/grpc v1.68.1 // indirect
4851
)
4952

5053
go 1.24.0

go.sum

Lines changed: 64 additions & 68 deletions
Large diffs are not rendered by default.

local/local_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,7 +1040,7 @@ func testImage(t *testing.T, when spec.G, it spec.S) {
10401040
inspect, err := dockerClient.ImageInspect(context.TODO(), repoName)
10411041
h.AssertNil(t, err)
10421042

1043-
h.AssertEq(t, []string(inspect.Config.Entrypoint), []string{"some", "entrypoint"})
1043+
h.AssertEq(t, inspect.Config.Entrypoint, []string{"some", "entrypoint"})
10441044
})
10451045
})
10461046

@@ -1063,7 +1063,7 @@ func testImage(t *testing.T, when spec.G, it spec.S) {
10631063
inspect, err := dockerClient.ImageInspect(context.TODO(), repoName)
10641064
h.AssertNil(t, err)
10651065

1066-
h.AssertEq(t, []string(inspect.Config.Cmd), []string{"some", "cmd"})
1066+
h.AssertEq(t, inspect.Config.Cmd, []string{"some", "cmd"})
10671067
})
10681068
})
10691069

local/new.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import (
44
"context"
55
"fmt"
66

7+
cerrdefs "github.com/containerd/errdefs"
78
"github.com/docker/docker/api/types/image"
8-
"github.com/docker/docker/client"
99
v1 "github.com/google/go-containerregistry/pkg/v1"
1010

1111
"github.com/buildpacks/imgutil"
@@ -121,7 +121,7 @@ func processImageOption(repoName string, dockerClient DockerClient, downloadLaye
121121
func getInspectAndHistory(repoName string, dockerClient DockerClient) (*image.InspectResponse, []image.HistoryResponseItem, error) {
122122
inspect, err := dockerClient.ImageInspect(context.Background(), repoName)
123123
if err != nil {
124-
if client.IsErrNotFound(err) {
124+
if cerrdefs.IsNotFound(err) {
125125
return nil, nil, nil
126126
}
127127
return nil, nil, fmt.Errorf("inspecting image %q: %w", repoName, err)

local/store.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"strings"
1313
"sync"
1414

15+
cerrdefs "github.com/containerd/errdefs"
1516
"github.com/docker/docker/api/types"
1617
"github.com/docker/docker/api/types/image"
1718
"github.com/docker/docker/api/types/system"
@@ -190,7 +191,7 @@ func (s *Store) doSave(img v1.Image, withName string) (image.InspectResponse, er
190191

191192
inspect, err := s.dockerClient.ImageInspect(context.Background(), withName)
192193
if err != nil {
193-
if client.IsErrNotFound(err) {
194+
if cerrdefs.IsNotFound(err) {
194195
return image.InspectResponse{}, fmt.Errorf("saving image %q: %w", withName, err)
195196
}
196197
return image.InspectResponse{}, err

local/v1_facade.go

Lines changed: 15 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ import (
66
"io"
77
"time"
88

9-
"github.com/docker/docker/api/types/container"
109
"github.com/docker/docker/api/types/image"
1110
v1 "github.com/google/go-containerregistry/pkg/v1"
1211
"github.com/google/go-containerregistry/pkg/v1/empty"
1312
"github.com/google/go-containerregistry/pkg/v1/mutate"
1413
v1types "github.com/google/go-containerregistry/pkg/v1/types"
14+
dockerspec "github.com/moby/docker-image-spec/specs-go/v1"
1515

1616
"github.com/buildpacks/imgutil"
1717
)
@@ -132,7 +132,7 @@ func toV1History(history []image.HistoryResponseItem) []v1.History {
132132
return v1History
133133
}
134134

135-
func toV1Config(dockerCfg *container.Config) v1.Config {
135+
func toV1Config(dockerCfg *dockerspec.DockerOCIImageConfig) v1.Config {
136136
if dockerCfg == nil {
137137
return v1.Config{}
138138
}
@@ -148,32 +148,21 @@ func toV1Config(dockerCfg *container.Config) v1.Config {
148148
}
149149
exposedPorts := make(map[string]struct{}, len(dockerCfg.ExposedPorts))
150150
for key, val := range dockerCfg.ExposedPorts {
151-
exposedPorts[string(key)] = val
151+
exposedPorts[key] = val
152152
}
153153
return v1.Config{
154-
AttachStderr: dockerCfg.AttachStderr,
155-
AttachStdin: dockerCfg.AttachStdin,
156-
AttachStdout: dockerCfg.AttachStdout,
157-
Cmd: dockerCfg.Cmd,
158-
Healthcheck: healthcheck,
159-
Domainname: dockerCfg.Domainname,
160-
Entrypoint: dockerCfg.Entrypoint,
161-
Env: dockerCfg.Env,
162-
Hostname: dockerCfg.Hostname,
163-
Image: dockerCfg.Image,
164-
Labels: dockerCfg.Labels,
165-
OnBuild: dockerCfg.OnBuild,
166-
OpenStdin: dockerCfg.OpenStdin,
167-
StdinOnce: dockerCfg.StdinOnce,
168-
Tty: dockerCfg.Tty,
169-
User: dockerCfg.User,
170-
Volumes: dockerCfg.Volumes,
171-
WorkingDir: dockerCfg.WorkingDir,
172-
ExposedPorts: exposedPorts,
173-
ArgsEscaped: dockerCfg.ArgsEscaped,
174-
NetworkDisabled: dockerCfg.NetworkDisabled,
175-
StopSignal: dockerCfg.StopSignal,
176-
Shell: dockerCfg.Shell,
154+
Cmd: dockerCfg.Cmd,
155+
Healthcheck: healthcheck,
156+
Entrypoint: dockerCfg.Entrypoint,
157+
Env: dockerCfg.Env,
158+
Labels: dockerCfg.Labels,
159+
OnBuild: dockerCfg.OnBuild,
160+
User: dockerCfg.User,
161+
Volumes: dockerCfg.Volumes,
162+
WorkingDir: dockerCfg.WorkingDir,
163+
ExposedPorts: exposedPorts,
164+
StopSignal: dockerCfg.StopSignal,
165+
Shell: dockerCfg.Shell,
177166
}
178167
}
179168

testhelpers/testhelpers.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"testing"
2323
"time"
2424

25+
cerrdefs "github.com/containerd/errdefs"
2526
"github.com/docker/docker/api/types/image"
2627
dockercli "github.com/docker/docker/client"
2728
"github.com/docker/docker/pkg/jsonmessage"
@@ -176,7 +177,7 @@ func PullIfMissing(t *testing.T, docker dockercli.APIClient, ref string) {
176177
if err == nil {
177178
return
178179
}
179-
if !dockercli.IsErrNotFound(err) {
180+
if !cerrdefs.IsNotFound(err) {
180181
t.Fatalf("failed inspecting image '%s': %s", ref, err)
181182
}
182183

0 commit comments

Comments
 (0)