diff --git a/go.mod b/go.mod index 856441f660..015dd5254b 100644 --- a/go.mod +++ b/go.mod @@ -57,7 +57,7 @@ require ( github.com/miekg/dns v1.1.66 github.com/mistifyio/go-zfs/v3 v3.1.0 github.com/mitchellh/copystructure v1.2.0 - github.com/moby/buildkit v0.26.2 + github.com/moby/buildkit v0.26.3 github.com/moby/docker-image-spec v1.3.1 github.com/moby/go-archive v0.1.0 github.com/moby/ipvs v1.1.0 diff --git a/go.sum b/go.sum index 8cc5f40b7d..02eb7dbf2f 100644 --- a/go.sum +++ b/go.sum @@ -421,8 +421,8 @@ github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:F github.com/mitchellh/mapstructure v0.0.0-20170523030023-d0303fe80992/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= -github.com/moby/buildkit v0.26.2 h1:EIh5j0gzRsCZmQzvgNNWzSDbuKqwUIiBH7ssqLv8RU8= -github.com/moby/buildkit v0.26.2/go.mod h1:ylDa7IqzVJgLdi/wO7H1qLREFQpmhFbw2fbn4yoTw40= +github.com/moby/buildkit v0.26.3 h1:D+ruZVAk/3ipRq5XRxBH9/DIFpRjSlTtMbghT5gQP9g= +github.com/moby/buildkit v0.26.3/go.mod h1:4T4wJzQS4kYWIfFRjsbJry4QoxDBjK+UGOEOs1izL7w= 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/go-archive v0.1.0 h1:Kk/5rdW/g+H8NHdJW2gsXyZ7UnzvJNOy6VKJqueWdcQ= diff --git a/vendor/github.com/moby/buildkit/frontend/gateway/gateway.go b/vendor/github.com/moby/buildkit/frontend/gateway/gateway.go index e35adab1f1..a27307a000 100644 --- a/vendor/github.com/moby/buildkit/frontend/gateway/gateway.go +++ b/vendor/github.com/moby/buildkit/frontend/gateway/gateway.go @@ -653,43 +653,7 @@ func (lbf *llbBridgeForwarder) ResolveSourceMeta(ctx context.Context, req *pb.Re if err != nil { return nil, err } - - r := &pb.ResolveSourceMetaResponse{ - Source: resp.Op, - } - - if resp.Image != nil { - r.Image = &pb.ResolveSourceImageResponse{ - Digest: string(resp.Image.Digest), - Config: resp.Image.Config, - } - if resp.Image.AttestationChain != nil { - r.Image.AttestationChain = toPBAttestationChain(resp.Image.AttestationChain) - } - } - if resp.Git != nil { - r.Git = &pb.ResolveSourceGitResponse{ - Checksum: resp.Git.Checksum, - Ref: resp.Git.Ref, - CommitChecksum: resp.Git.CommitChecksum, - CommitObject: resp.Git.CommitObject, - TagObject: resp.Git.TagObject, - } - } - if resp.HTTP != nil { - var lastModified *timestamp.Timestamp - if resp.HTTP.LastModified != nil { - lastModified = ×tamp.Timestamp{ - Seconds: resp.HTTP.LastModified.Unix(), - } - } - r.HTTP = &pb.ResolveSourceHTTPResponse{ - Checksum: resp.HTTP.Digest.String(), - Filename: resp.HTTP.Filename, - LastModified: lastModified, - } - } - return r, nil + return ToPBResolveSourceMetaResponse(resp), nil } func (lbf *llbBridgeForwarder) ResolveImageConfig(ctx context.Context, req *pb.ResolveImageConfigRequest) (*pb.ResolveImageConfigResponse, error) { @@ -1705,6 +1669,45 @@ func getCaps(label string) map[string]struct{} { return out } +func ToPBResolveSourceMetaResponse(in *sourceresolver.MetaResponse) *pb.ResolveSourceMetaResponse { + r := &pb.ResolveSourceMetaResponse{ + Source: in.Op, + } + + if in.Image != nil { + r.Image = &pb.ResolveSourceImageResponse{ + Digest: string(in.Image.Digest), + Config: in.Image.Config, + } + if in.Image.AttestationChain != nil { + r.Image.AttestationChain = toPBAttestationChain(in.Image.AttestationChain) + } + } + if in.Git != nil { + r.Git = &pb.ResolveSourceGitResponse{ + Checksum: in.Git.Checksum, + Ref: in.Git.Ref, + CommitChecksum: in.Git.CommitChecksum, + CommitObject: in.Git.CommitObject, + TagObject: in.Git.TagObject, + } + } + if in.HTTP != nil { + var lastModified *timestamp.Timestamp + if in.HTTP.LastModified != nil { + lastModified = ×tamp.Timestamp{ + Seconds: in.HTTP.LastModified.Unix(), + } + } + r.HTTP = &pb.ResolveSourceHTTPResponse{ + Checksum: in.HTTP.Digest.String(), + Filename: in.HTTP.Filename, + LastModified: lastModified, + } + } + return r +} + func toPBAttestationChain(ac *sourceresolver.AttestationChain) *pb.AttestationChain { if ac == nil { return nil diff --git a/vendor/github.com/moby/buildkit/solver/llbsolver/policy.go b/vendor/github.com/moby/buildkit/solver/llbsolver/policy.go index 867630777e..0beb917a77 100644 --- a/vendor/github.com/moby/buildkit/solver/llbsolver/policy.go +++ b/vendor/github.com/moby/buildkit/solver/llbsolver/policy.go @@ -5,6 +5,7 @@ import ( "strings" "github.com/moby/buildkit/client/llb/sourceresolver" + "github.com/moby/buildkit/frontend/gateway" gatewaypb "github.com/moby/buildkit/frontend/gateway/pb" "github.com/moby/buildkit/solver/pb" "github.com/moby/buildkit/sourcepolicy" @@ -88,19 +89,26 @@ func (p *policyEvaluator) Evaluate(ctx context.Context, op *pb.Op) (bool, error) Platform: toOCIPlatform(metareq.Platform), } } + + if metareq.Image != nil { + if op.ImageOpt == nil { + op.ImageOpt = &sourceresolver.ResolveImageOpt{} + } + op.ImageOpt.NoConfig = metareq.Image.NoConfig + op.ImageOpt.AttestationChain = metareq.Image.AttestationChain + } + + if metareq.Git != nil { + op.GitOpt = &sourceresolver.ResolveGitOpt{ + ReturnObject: metareq.Git.ReturnObject, + } + } + resp, err := p.resolveSourceMetadata(ctx, metareq.Source, op, false) if err != nil { return false, errors.Wrap(err, "error resolving source metadata from policy request") } - req.Source = &gatewaypb.ResolveSourceMetaResponse{ - Source: resp.Op, - } - if resp.Image != nil { - req.Source.Image = &gatewaypb.ResolveSourceImageResponse{ - Digest: resp.Image.Digest.String(), - Config: resp.Image.Config, - } - } + req.Source = gateway.ToPBResolveSourceMetaResponse(resp) continue } diff --git a/vendor/modules.txt b/vendor/modules.txt index 12e7ad1549..f1531dca19 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -853,7 +853,7 @@ github.com/mitchellh/hashstructure/v2 # github.com/mitchellh/reflectwalk v1.0.2 ## explicit github.com/mitchellh/reflectwalk -# github.com/moby/buildkit v0.26.2 +# github.com/moby/buildkit v0.26.3 ## explicit; go 1.24.3 github.com/moby/buildkit/api/services/control github.com/moby/buildkit/api/types