Merge pull request #47582 from vvoland/vendor-buildkit-0.13.1

vendor: github.com/moby/buildkit v0.13.1
This commit is contained in:
Sebastiaan van Stijn 2024-03-18 21:53:15 +01:00 committed by GitHub
commit 23e1af45c6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 32 additions and 12 deletions

View file

@ -60,7 +60,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.13.0
github.com/moby/buildkit v0.13.1
github.com/moby/docker-image-spec v1.3.1
github.com/moby/ipvs v1.1.0
github.com/moby/locker v1.0.1

View file

@ -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.13.0 h1:reVR1Y+rbNIUQ9jf0Q1YZVH5a/nhOixZsl+HJ9qQEGI=
github.com/moby/buildkit v0.13.0/go.mod h1:aNmNQKLBFYAOFuzQjR3VA27/FijlvtBD1pjNwTSN37k=
github.com/moby/buildkit v0.13.1 h1:L8afOFhPq2RPJJSr/VyzbufwID7jquZVB7oFHbPRcPE=
github.com/moby/buildkit v0.13.1/go.mod h1:aNmNQKLBFYAOFuzQjR3VA27/FijlvtBD1pjNwTSN37k=
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=

View file

@ -122,6 +122,8 @@ type DescriptorProviderPair struct {
Provider content.Provider
}
var _ withCheckDescriptor = DescriptorProviderPair{}
func (p DescriptorProviderPair) ReaderAt(ctx context.Context, desc ocispecs.Descriptor) (content.ReaderAt, error) {
return p.Provider.ReaderAt(ctx, desc)
}
@ -156,6 +158,13 @@ func (p DescriptorProviderPair) SnapshotLabels(descs []ocispecs.Descriptor, inde
return nil
}
func (p DescriptorProviderPair) CheckDescriptor(ctx context.Context, desc ocispecs.Descriptor) error {
if cd, ok := p.Provider.(withCheckDescriptor); ok {
return cd.CheckDescriptor(ctx, desc)
}
return nil
}
// item is an implementation of a record in the cache chain. After validation,
// normalization and marshalling into the cache config, the item results form
// into the "layers", while the digests and the links form into the "records".

View file

@ -12,6 +12,11 @@ import (
"github.com/pkg/errors"
)
type withCheckDescriptor interface {
// CheckDescriptor is additional method on Provider to check if the descriptor is available without opening the reader
CheckDescriptor(context.Context, ocispecs.Descriptor) error
}
// sortConfig sorts the config structure to make sure it is deterministic
func sortConfig(cc *CacheConfig) {
type indexedLayer struct {
@ -279,9 +284,7 @@ func marshalRemote(ctx context.Context, r *solver.Remote, state *marshalState) s
return ""
}
if cd, ok := r.Provider.(interface {
CheckDescriptor(context.Context, ocispecs.Descriptor) error
}); ok && len(r.Descriptors) > 0 {
if cd, ok := r.Provider.(withCheckDescriptor); ok && len(r.Descriptors) > 0 {
for _, d := range r.Descriptors {
if cd.CheckDescriptor(ctx, d) != nil {
return ""

View file

@ -2,6 +2,7 @@ package oci
import (
"context"
"os"
"path"
"path/filepath"
"runtime"
@ -197,8 +198,11 @@ func GenerateSpec(ctx context.Context, meta executor.Meta, mounts []executor.Mou
}
if tracingSocket != "" {
if mount := getTracingSocketMount(tracingSocket); mount != nil {
s.Mounts = append(s.Mounts, *mount)
// moby/buildkit#4764
if _, err := os.Stat(tracingSocket); err == nil {
if mount := getTracingSocketMount(tracingSocket); mount != nil {
s.Mounts = append(s.Mounts, *mount)
}
}
}

View file

@ -125,8 +125,10 @@ func New(opt Opt) (*Solver, error) {
func (s *Solver) Close() error {
s.solver.Close()
err := s.sysSampler.Close()
return err
if s.sysSampler != nil {
return s.sysSampler.Close()
}
return nil
}
func (s *Solver) resolver() solver.ResolveOpFunc {

View file

@ -57,7 +57,9 @@ func ParseGitRef(ref string) (*GitRef, error) {
err error
)
if strings.HasPrefix(ref, "github.com/") {
if strings.HasPrefix(ref, "./") || strings.HasPrefix(ref, "../") {
return nil, errdefs.ErrInvalidArgument
} else if strings.HasPrefix(ref, "github.com/") {
res.IndistinguishableFromLocal = true // Deprecated
remote = fromURL(&url.URL{
Scheme: "https",

2
vendor/modules.txt vendored
View file

@ -702,7 +702,7 @@ github.com/mitchellh/hashstructure/v2
# github.com/mitchellh/reflectwalk v1.0.2
## explicit
github.com/mitchellh/reflectwalk
# github.com/moby/buildkit v0.13.0
# github.com/moby/buildkit v0.13.1
## explicit; go 1.21
github.com/moby/buildkit/api/services/control
github.com/moby/buildkit/api/types