Skip to content

Commit

Permalink
Bump imgutil and docker (#1335)
Browse files Browse the repository at this point in the history
* Bump imgutil and docker

Signed-off-by: Natalie Arellano <[email protected]>

* Grab latest and avoid using "AddOrReuse" method as it requires updating the caching image

Signed-off-by: Natalie Arellano <[email protected]>

---------

Signed-off-by: Natalie Arellano <[email protected]>
  • Loading branch information
natalieparellano authored Apr 16, 2024
1 parent 27ee435 commit 82fdf23
Show file tree
Hide file tree
Showing 10 changed files with 65 additions and 134 deletions.
61 changes: 4 additions & 57 deletions cmd/lifecycle/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ import (
"github.com/buildpacks/imgutil/layout"
"github.com/buildpacks/imgutil/local"
"github.com/buildpacks/imgutil/remote"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/client"
"github.com/docker/go-connections/nat"
"github.com/google/go-containerregistry/pkg/authn"
"github.com/google/go-containerregistry/pkg/name"
v1 "github.com/google/go-containerregistry/pkg/v1"
Expand Down Expand Up @@ -261,7 +259,7 @@ func (e *exportCmd) export(group buildpack.Group, cacheStore phase.Cache, analyz
}

func (e *exportCmd) initDaemonAppImage(analyzedMD files.Analyzed) (imgutil.Image, string, error) {
var opts = []local.ImageOption{
var opts = []imgutil.ImageOption{
local.FromBaseImage(e.RunImageRef),
}
if e.supportsRunImageExtension() {
Expand All @@ -270,7 +268,7 @@ func (e *exportCmd) initDaemonAppImage(analyzedMD files.Analyzed) (imgutil.Image
return nil, "", cmd.FailErr(err, "get extended image config")
}
if extendedConfig != nil {
opts = append(opts, local.WithConfig(toContainerConfig(extendedConfig)))
opts = append(opts, local.WithConfig(extendedConfig))
}
}

Expand Down Expand Up @@ -312,59 +310,8 @@ func (e *exportCmd) initDaemonAppImage(analyzedMD files.Analyzed) (imgutil.Image
return appImage, runImageID.String(), nil
}

func toContainerConfig(v1C *v1.Config) *container.Config {
return &container.Config{
ArgsEscaped: v1C.ArgsEscaped,
AttachStderr: v1C.AttachStderr,
AttachStdin: v1C.AttachStdin,
AttachStdout: v1C.AttachStdout,
Cmd: v1C.Cmd,
Domainname: v1C.Domainname,
Entrypoint: v1C.Entrypoint,
Env: v1C.Env,
ExposedPorts: toNATPortSet(v1C.ExposedPorts),
Healthcheck: toHealthConfig(v1C.Healthcheck),
Hostname: v1C.Hostname,
Image: v1C.Image,
Labels: v1C.Labels,
MacAddress: v1C.MacAddress,
NetworkDisabled: v1C.NetworkDisabled,
OnBuild: v1C.OnBuild,
OpenStdin: v1C.OpenStdin,
Shell: v1C.Shell,
StdinOnce: v1C.StdinOnce,
StopSignal: v1C.StopSignal,
StopTimeout: nil,
Tty: v1C.Tty,
User: v1C.User,
Volumes: v1C.Volumes,
WorkingDir: v1C.WorkingDir,
}
}

func toHealthConfig(v1H *v1.HealthConfig) *container.HealthConfig {
if v1H == nil {
return &container.HealthConfig{}
}
return &container.HealthConfig{
Interval: v1H.Interval,
Retries: v1H.Retries,
StartPeriod: v1H.StartPeriod,
Test: v1H.Test,
Timeout: v1H.Timeout,
}
}

func toNATPortSet(v1Ps map[string]struct{}) nat.PortSet {
portSet := make(map[nat.Port]struct{})
for k, v := range v1Ps {
portSet[nat.Port(k)] = v
}
return portSet
}

func (e *exportCmd) initRemoteAppImage(analyzedMD files.Analyzed) (imgutil.Image, string, error) {
var opts = []remote.ImageOption{
var opts = []imgutil.ImageOption{
remote.FromBaseImage(e.RunImageRef),
}

Expand Down Expand Up @@ -420,7 +367,7 @@ func (e *exportCmd) initLayoutAppImage(analyzedMD files.Analyzed) (imgutil.Image
return nil, "", cmd.FailErr(err, "parsing run image reference")
}

var opts = []layout.ImageOption{
var opts = []imgutil.ImageOption{
layout.FromBaseImagePath(runImageIdentifier.Path),
}

Expand Down
4 changes: 2 additions & 2 deletions cmd/lifecycle/rebaser.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func (r *rebaseCmd) Exec() error {
local.FromBaseImage(r.RunImageRef),
)
} else {
var opts []remote.ImageOption
var opts []imgutil.ImageOption
opts = append(opts, append(image.GetInsecureOptions(r.InsecureRegistries), remote.FromBaseImage(r.RunImageRef))...)

newBaseImage, err = remote.NewImage(
Expand Down Expand Up @@ -168,7 +168,7 @@ func (r *rebaseCmd) setAppImage() error {
return err
}

var opts = []remote.ImageOption{
var opts = []imgutil.ImageOption{
remote.FromBaseImage(targetImageRef),
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/lifecycle/restorer.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ func (r *restoreCmd) pullSparse(imageRef string) (imgutil.Image, error) {
return nil, fmt.Errorf("failed to create cache directory: %w", err)
}

var opts []remote.ImageOption
var opts []imgutil.ImageOption
opts = append(opts, append(image.GetInsecureOptions(r.InsecureRegistries), remote.FromBaseImage(imageRef))...)

// get remote image
Expand Down
28 changes: 14 additions & 14 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ require (
github.com/GoogleContainerTools/kaniko v1.21.1
github.com/apex/log v1.9.0
github.com/awslabs/amazon-ecr-credential-helper/ecr-login v0.0.0-20231213181459-b0fcec718dc6
github.com/buildpacks/imgutil v0.0.0-20240206215312-f8d38e1de03d
github.com/buildpacks/imgutil v0.0.0-20240416145632-bef4977c8877
github.com/chrismellard/docker-credential-acr-env v0.0.0-20230304212654-82a0ddb27589
github.com/containerd/containerd v1.7.14
github.com/docker/docker v25.0.5+incompatible
github.com/docker/go-connections v0.5.0
github.com/docker/docker v26.0.1+incompatible
github.com/golang/mock v1.6.0
github.com/google/go-cmp v0.6.0
github.com/google/go-containerregistry v0.19.1
Expand All @@ -18,7 +17,7 @@ require (
github.com/moby/buildkit v0.13.1
github.com/pkg/errors v0.9.1
github.com/sclevine/spec v1.4.0
golang.org/x/sync v0.6.0
golang.org/x/sync v0.7.0
golang.org/x/sys v0.18.0
)

Expand Down Expand Up @@ -68,10 +67,11 @@ require (
github.com/containerd/typeurl/v2 v2.1.1 // indirect
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
github.com/dimchansky/utfbom v1.1.1 // indirect
github.com/distribution/reference v0.5.0 // indirect
github.com/distribution/reference v0.6.0 // indirect
github.com/docker/cli v25.0.3+incompatible // indirect
github.com/docker/distribution v2.8.3+incompatible // indirect
github.com/docker/docker-credential-helpers v0.8.0 // indirect
github.com/docker/go-connections v0.5.0 // indirect
github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c // indirect
github.com/docker/go-metrics v0.0.1 // indirect
github.com/docker/go-units v0.5.0 // indirect
Expand All @@ -94,9 +94,9 @@ require (
github.com/klauspost/compress v1.17.4 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/minio/highwayhash v1.0.2 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/moby/docker-image-spec v1.3.1 // indirect
github.com/moby/locker v1.0.1 // indirect
github.com/moby/patternmatcher v0.6.0 // indirect
github.com/moby/swarmkit/v2 v2.0.0-20230911190601-f082dd7a0cee // indirect
Expand All @@ -113,23 +113,23 @@ require (
github.com/opencontainers/runtime-spec v1.1.0 // indirect
github.com/opencontainers/selinux v1.11.0 // indirect
github.com/otiai10/copy v1.14.0 // indirect
github.com/prometheus/client_golang v1.17.0 // indirect
github.com/prometheus/client_golang v1.19.0 // indirect
github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/common v0.44.0 // indirect
github.com/prometheus/common v0.48.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/spf13/afero v1.11.0 // indirect
github.com/vbatts/tar-split v0.11.5 // indirect
go.etcd.io/etcd/raft/v3 v3.5.9 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.48.0 // indirect
go.opentelemetry.io/otel v1.23.0 // indirect
go.opentelemetry.io/otel/metric v1.23.0 // indirect
go.opentelemetry.io/otel/trace v1.23.0 // indirect
golang.org/x/crypto v0.19.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.50.0 // indirect
go.opentelemetry.io/otel v1.25.0 // indirect
go.opentelemetry.io/otel/metric v1.25.0 // indirect
go.opentelemetry.io/otel/trace v1.25.0 // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/exp v0.0.0-20231219160207-73b9e39aefca // indirect
golang.org/x/mod v0.14.0 // indirect
golang.org/x/net v0.21.0 // indirect
golang.org/x/net v0.23.0 // indirect
golang.org/x/oauth2 v0.17.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.5.0 // indirect
Expand Down
Loading

0 comments on commit 82fdf23

Please sign in to comment.