From 049765e4a1169dacab9efadf86d5363039e4ce8a Mon Sep 17 00:00:00 2001 From: Tonis Tiigi Date: Thu, 15 Aug 2024 18:13:37 +0300 Subject: [PATCH] vendor: update buildkit to v0.15.2 Also brings in fix for moby/buildkit#5242 Signed-off-by: Tonis Tiigi --- builder/builder-next/worker/worker.go | 3 +- vendor.mod | 2 +- vendor.sum | 4 +- .../nydus-snapshotter/pkg/errdefs/errors.go | 50 ------------------- .../buildkit/cache/remotecache/v1/utils.go | 5 +- .../moby/buildkit/client/llb/exec.go | 2 + .../buildkit/snapshot/containerd/content.go | 6 +-- .../buildkit/solver/llbsolver/ops/exec.go | 5 ++ vendor/modules.txt | 3 +- 9 files changed, 20 insertions(+), 60 deletions(-) delete mode 100644 vendor/github.com/containerd/nydus-snapshotter/pkg/errdefs/errors.go diff --git a/builder/builder-next/worker/worker.go b/builder/builder-next/worker/worker.go index 779931542fb3f..0ea938367e8e4 100644 --- a/builder/builder-next/worker/worker.go +++ b/builder/builder-next/worker/worker.go @@ -10,6 +10,7 @@ import ( "github.com/containerd/containerd/content" "github.com/containerd/containerd/images" "github.com/containerd/containerd/rootfs" + cerrdefs "github.com/containerd/errdefs" "github.com/containerd/log" "github.com/containerd/platforms" imageadapter "github.com/docker/docker/builder/builder-next/adapters/containerimage" @@ -572,5 +573,5 @@ func (p *emptyProvider) ReaderAt(ctx context.Context, dec ocispec.Descriptor) (c } func (p *emptyProvider) Info(ctx context.Context, d digest.Digest) (content.Info, error) { - return content.Info{}, errors.Errorf("Info not implemented for empty provider") + return content.Info{}, errors.Wrapf(cerrdefs.ErrNotImplemented, "Info not implemented for empty provider") } diff --git a/vendor.mod b/vendor.mod index 934b4c6e9e553..aa7efd43eeafc 100644 --- a/vendor.mod +++ b/vendor.mod @@ -63,7 +63,7 @@ require ( github.com/miekg/dns v1.1.57 github.com/mistifyio/go-zfs/v3 v3.0.1 github.com/mitchellh/copystructure v1.2.0 - github.com/moby/buildkit v0.15.1 + github.com/moby/buildkit v0.15.2 github.com/moby/docker-image-spec v1.3.1 github.com/moby/ipvs v1.1.0 github.com/moby/locker v1.0.1 diff --git a/vendor.sum b/vendor.sum index 7294f2f72a605..ada0bc5537ea7 100644 --- a/vendor.sum +++ b/vendor.sum @@ -476,8 +476,8 @@ github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/mndrix/tap-go v0.0.0-20171203230836-629fa407e90b/go.mod h1:pzzDgJWZ34fGzaAZGFW22KVZDfyrYW+QABMrWnJBnSs= -github.com/moby/buildkit v0.15.1 h1:J6wrew7hphKqlq1wuu6yaUb/1Ra7gEzDAovylGztAKM= -github.com/moby/buildkit v0.15.1/go.mod h1:Yis8ZMUJTHX9XhH9zVyK2igqSHV3sxi3UN0uztZocZk= +github.com/moby/buildkit v0.15.2 h1:DnONr0AoceTWyv+plsQ7IhkSaj+6o0WyoaxYPyTFIxs= +github.com/moby/buildkit v0.15.2/go.mod h1:Yis8ZMUJTHX9XhH9zVyK2igqSHV3sxi3UN0uztZocZk= github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0= github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo= github.com/moby/ipvs v1.1.0 h1:ONN4pGaZQgAx+1Scz5RvWV4Q7Gb+mvfRh3NsPS+1XQQ= diff --git a/vendor/github.com/containerd/nydus-snapshotter/pkg/errdefs/errors.go b/vendor/github.com/containerd/nydus-snapshotter/pkg/errdefs/errors.go deleted file mode 100644 index e515704dd9172..0000000000000 --- a/vendor/github.com/containerd/nydus-snapshotter/pkg/errdefs/errors.go +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2020. Ant Group. All rights reserved. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -package errdefs - -import ( - stderrors "errors" - "net" - "syscall" - - "github.com/containerd/errdefs" - "github.com/pkg/errors" -) - -var ( - ErrAlreadyExists = errdefs.ErrAlreadyExists - ErrNotFound = errdefs.ErrNotFound - ErrInvalidArgument = errors.New("invalid argument") - ErrUnavailable = errors.New("unavailable") - ErrNotImplemented = errors.New("not implemented") // represents not supported and unimplemented - ErrDeviceBusy = errors.New("device busy") // represents not supported and unimplemented -) - -// IsAlreadyExists returns true if the error is due to already exists -func IsAlreadyExists(err error) bool { - return errors.Is(err, ErrAlreadyExists) -} - -// IsNotFound returns true if the error is due to a missing object -func IsNotFound(err error) bool { - return errors.Is(err, ErrNotFound) -} - -// IsConnectionClosed returns true if error is due to connection closed -// this is used when snapshotter closed by sig term -func IsConnectionClosed(err error) bool { - switch err := err.(type) { - case *net.OpError: - return err.Err.Error() == "use of closed network connection" - default: - return false - } -} - -func IsErofsMounted(err error) bool { - return stderrors.Is(err, syscall.EBUSY) -} diff --git a/vendor/github.com/moby/buildkit/cache/remotecache/v1/utils.go b/vendor/github.com/moby/buildkit/cache/remotecache/v1/utils.go index 79cf846391fe3..ef0294d75f18d 100644 --- a/vendor/github.com/moby/buildkit/cache/remotecache/v1/utils.go +++ b/vendor/github.com/moby/buildkit/cache/remotecache/v1/utils.go @@ -5,6 +5,7 @@ import ( "fmt" "sort" + cerrdefs "github.com/containerd/errdefs" "github.com/moby/buildkit/solver" "github.com/moby/buildkit/util/bklog" digest "github.com/opencontainers/go-digest" @@ -281,7 +282,9 @@ func marshalRemote(ctx context.Context, r *solver.Remote, state *marshalState) s if r.Provider != nil { for _, d := range r.Descriptors { if _, err := r.Provider.Info(ctx, d.Digest); err != nil { - return "" + if !cerrdefs.IsNotImplemented(err) { + return "" + } } } } diff --git a/vendor/github.com/moby/buildkit/client/llb/exec.go b/vendor/github.com/moby/buildkit/client/llb/exec.go index 457a9b1f2f8e1..faba8bddc72b1 100644 --- a/vendor/github.com/moby/buildkit/client/llb/exec.go +++ b/vendor/github.com/moby/buildkit/client/llb/exec.go @@ -396,6 +396,7 @@ func (e *ExecOp) Marshal(ctx context.Context, c *Constraints) (digest.Digest, [] }) } else { pm := &pb.Mount{ + Input: pb.Empty, Dest: s.Target, MountType: pb.MountType_SECRET, SecretOpt: &pb.SecretOpt{ @@ -412,6 +413,7 @@ func (e *ExecOp) Marshal(ctx context.Context, c *Constraints) (digest.Digest, [] for _, s := range e.ssh { pm := &pb.Mount{ + Input: pb.Empty, Dest: s.Target, MountType: pb.MountType_SSH, SSHOpt: &pb.SSHOpt{ diff --git a/vendor/github.com/moby/buildkit/snapshot/containerd/content.go b/vendor/github.com/moby/buildkit/snapshot/containerd/content.go index f137dd5c54506..e418a06712143 100644 --- a/vendor/github.com/moby/buildkit/snapshot/containerd/content.go +++ b/vendor/github.com/moby/buildkit/snapshot/containerd/content.go @@ -5,7 +5,7 @@ import ( "github.com/containerd/containerd/content" "github.com/containerd/containerd/namespaces" - "github.com/containerd/nydus-snapshotter/pkg/errdefs" + cerrdefs "github.com/containerd/errdefs" digest "github.com/opencontainers/go-digest" ocispecs "github.com/opencontainers/image-spec/specs-go/v1" "github.com/pkg/errors" @@ -103,7 +103,7 @@ var _ content.Store = &nsFallbackStore{} func (c *nsFallbackStore) Info(ctx context.Context, dgst digest.Digest) (content.Info, error) { info, err := c.main.Info(ctx, dgst) if err != nil { - if errdefs.IsNotFound(err) { + if cerrdefs.IsNotFound(err) { return c.fb.Info(ctx, dgst) } } @@ -137,7 +137,7 @@ func (c *nsFallbackStore) Abort(ctx context.Context, ref string) error { func (c *nsFallbackStore) ReaderAt(ctx context.Context, desc ocispecs.Descriptor) (content.ReaderAt, error) { ra, err := c.main.ReaderAt(ctx, desc) if err != nil { - if errdefs.IsNotFound(err) { + if cerrdefs.IsNotFound(err) { return c.fb.ReaderAt(ctx, desc) } } diff --git a/vendor/github.com/moby/buildkit/solver/llbsolver/ops/exec.go b/vendor/github.com/moby/buildkit/solver/llbsolver/ops/exec.go index 5f6777592e09e..058d911353e20 100644 --- a/vendor/github.com/moby/buildkit/solver/llbsolver/ops/exec.go +++ b/vendor/github.com/moby/buildkit/solver/llbsolver/ops/exec.go @@ -285,6 +285,11 @@ type dep struct { func (e *ExecOp) getMountDeps() ([]dep, error) { deps := make([]dep, e.numInputs) for _, m := range e.op.Mounts { + switch m.MountType { + case pb.MountType_SECRET, pb.MountType_SSH, pb.MountType_TMPFS: + continue + } + if m.Input == pb.Empty { continue } diff --git a/vendor/modules.txt b/vendor/modules.txt index 2e2acb43c9dd3..1847bece2c463 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -381,7 +381,6 @@ github.com/containerd/log/logtest ## explicit; go 1.21 github.com/containerd/nydus-snapshotter/pkg/converter github.com/containerd/nydus-snapshotter/pkg/converter/tool -github.com/containerd/nydus-snapshotter/pkg/errdefs github.com/containerd/nydus-snapshotter/pkg/label # github.com/containerd/platforms v0.2.1 ## explicit; go 1.20 @@ -708,7 +707,7 @@ github.com/mitchellh/hashstructure/v2 # github.com/mitchellh/reflectwalk v1.0.2 ## explicit github.com/mitchellh/reflectwalk -# github.com/moby/buildkit v0.15.1 +# github.com/moby/buildkit v0.15.2 ## explicit; go 1.21.0 github.com/moby/buildkit/api/services/control github.com/moby/buildkit/api/types