vendor: update buildkit v0.26.0-rc1
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
+11
-2
@@ -408,6 +408,7 @@ type SolveRequest struct {
|
||||
SourcePolicy *pb1.Policy `protobuf:"bytes,12,opt,name=SourcePolicy,proto3" json:"SourcePolicy,omitempty"`
|
||||
Exporters []*Exporter `protobuf:"bytes,13,rep,name=Exporters,proto3" json:"Exporters,omitempty"`
|
||||
EnableSessionExporter bool `protobuf:"varint,14,opt,name=EnableSessionExporter,proto3" json:"EnableSessionExporter,omitempty"`
|
||||
SourcePolicySession string `protobuf:"bytes,15,opt,name=SourcePolicySession,proto3" json:"SourcePolicySession,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
@@ -540,6 +541,13 @@ func (x *SolveRequest) GetEnableSessionExporter() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *SolveRequest) GetSourcePolicySession() string {
|
||||
if x != nil {
|
||||
return x.SourcePolicySession
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type CacheOptions struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
// ExportRefDeprecated is deprecated in favor or the new Exports since BuildKit v0.4.0.
|
||||
@@ -2050,7 +2058,7 @@ const file_github_com_moby_buildkit_api_services_control_control_proto_rawDesc =
|
||||
" \x01(\tR\n" +
|
||||
"RecordType\x12\x16\n" +
|
||||
"\x06Shared\x18\v \x01(\bR\x06Shared\x12\x18\n" +
|
||||
"\aParents\x18\f \x03(\tR\aParents\"\xf4\a\n" +
|
||||
"\aParents\x18\f \x03(\tR\aParents\"\xa6\b\n" +
|
||||
"\fSolveRequest\x12\x10\n" +
|
||||
"\x03Ref\x18\x01 \x01(\tR\x03Ref\x12.\n" +
|
||||
"\n" +
|
||||
@@ -2068,7 +2076,8 @@ const file_github_com_moby_buildkit_api_services_control_control_proto_rawDesc =
|
||||
"\bInternal\x18\v \x01(\bR\bInternal\x12I\n" +
|
||||
"\fSourcePolicy\x18\f \x01(\v2%.moby.buildkit.v1.sourcepolicy.PolicyR\fSourcePolicy\x128\n" +
|
||||
"\tExporters\x18\r \x03(\v2\x1a.moby.buildkit.v1.ExporterR\tExporters\x124\n" +
|
||||
"\x15EnableSessionExporter\x18\x0e \x01(\bR\x15EnableSessionExporter\x1aJ\n" +
|
||||
"\x15EnableSessionExporter\x18\x0e \x01(\bR\x15EnableSessionExporter\x120\n" +
|
||||
"\x13SourcePolicySession\x18\x0f \x01(\tR\x13SourcePolicySession\x1aJ\n" +
|
||||
"\x1cExporterAttrsDeprecatedEntry\x12\x10\n" +
|
||||
"\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" +
|
||||
"\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\x1a@\n" +
|
||||
|
||||
+1
@@ -76,6 +76,7 @@ message SolveRequest {
|
||||
moby.buildkit.v1.sourcepolicy.Policy SourcePolicy = 12;
|
||||
repeated Exporter Exporters = 13;
|
||||
bool EnableSessionExporter = 14;
|
||||
string SourcePolicySession = 15;
|
||||
}
|
||||
|
||||
message CacheOptions {
|
||||
|
||||
+47
@@ -142,6 +142,7 @@ func (m *SolveRequest) CloneVT() *SolveRequest {
|
||||
r.Internal = m.Internal
|
||||
r.SourcePolicy = m.SourcePolicy.CloneVT()
|
||||
r.EnableSessionExporter = m.EnableSessionExporter
|
||||
r.SourcePolicySession = m.SourcePolicySession
|
||||
if rhs := m.ExporterAttrsDeprecated; rhs != nil {
|
||||
tmpContainer := make(map[string]string, len(rhs))
|
||||
for k, v := range rhs {
|
||||
@@ -1039,6 +1040,9 @@ func (this *SolveRequest) EqualVT(that *SolveRequest) bool {
|
||||
if this.EnableSessionExporter != that.EnableSessionExporter {
|
||||
return false
|
||||
}
|
||||
if this.SourcePolicySession != that.SourcePolicySession {
|
||||
return false
|
||||
}
|
||||
return string(this.unknownFields) == string(that.unknownFields)
|
||||
}
|
||||
|
||||
@@ -2245,6 +2249,13 @@ func (m *SolveRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error) {
|
||||
i -= len(m.unknownFields)
|
||||
copy(dAtA[i:], m.unknownFields)
|
||||
}
|
||||
if len(m.SourcePolicySession) > 0 {
|
||||
i -= len(m.SourcePolicySession)
|
||||
copy(dAtA[i:], m.SourcePolicySession)
|
||||
i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.SourcePolicySession)))
|
||||
i--
|
||||
dAtA[i] = 0x7a
|
||||
}
|
||||
if m.EnableSessionExporter {
|
||||
i--
|
||||
if m.EnableSessionExporter {
|
||||
@@ -4159,6 +4170,10 @@ func (m *SolveRequest) SizeVT() (n int) {
|
||||
if m.EnableSessionExporter {
|
||||
n += 2
|
||||
}
|
||||
l = len(m.SourcePolicySession)
|
||||
if l > 0 {
|
||||
n += 1 + l + protohelpers.SizeOfVarint(uint64(l))
|
||||
}
|
||||
n += len(m.unknownFields)
|
||||
return n
|
||||
}
|
||||
@@ -6279,6 +6294,38 @@ func (m *SolveRequest) UnmarshalVT(dAtA []byte) error {
|
||||
}
|
||||
}
|
||||
m.EnableSessionExporter = bool(v != 0)
|
||||
case 15:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field SourcePolicySession", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return protohelpers.ErrIntOverflow
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
stringLen |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
intStringLen := int(stringLen)
|
||||
if intStringLen < 0 {
|
||||
return protohelpers.ErrInvalidLength
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return protohelpers.ErrInvalidLength
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.SourcePolicySession = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := protohelpers.Skip(dAtA[iNdEx:])
|
||||
|
||||
+2
-2
@@ -146,8 +146,8 @@ func Image(ref string, opts ...ImageOption) State {
|
||||
p = c.Platform
|
||||
}
|
||||
_, _, dt, err := info.metaResolver.ResolveImageConfig(ctx, ref, sourceresolver.Opt{
|
||||
Platform: p,
|
||||
ImageOpt: &sourceresolver.ResolveImageOpt{
|
||||
Platform: p,
|
||||
ResolveMode: info.resolveMode.String(),
|
||||
},
|
||||
})
|
||||
@@ -163,8 +163,8 @@ func Image(ref string, opts ...ImageOption) State {
|
||||
p = c.Platform
|
||||
}
|
||||
ref, dgst, dt, err := info.metaResolver.ResolveImageConfig(context.TODO(), ref, sourceresolver.Opt{
|
||||
Platform: p,
|
||||
ImageOpt: &sourceresolver.ResolveImageOpt{
|
||||
Platform: p,
|
||||
ResolveMode: info.resolveMode.String(),
|
||||
},
|
||||
})
|
||||
|
||||
+22
-5
@@ -24,7 +24,6 @@ type MetaResolver interface {
|
||||
type Opt struct {
|
||||
LogName string
|
||||
SourcePolicies []*spb.Policy
|
||||
Platform *ocispecs.Platform
|
||||
|
||||
ImageOpt *ResolveImageOpt
|
||||
OCILayoutOpt *ResolveOCILayoutOpt
|
||||
@@ -40,12 +39,29 @@ type MetaResponse struct {
|
||||
}
|
||||
|
||||
type ResolveImageOpt struct {
|
||||
ResolveMode string
|
||||
Platform *ocispecs.Platform
|
||||
ResolveMode string
|
||||
NoConfig bool
|
||||
AttestationChain bool
|
||||
}
|
||||
|
||||
type ResolveImageResponse struct {
|
||||
Digest digest.Digest
|
||||
Config []byte
|
||||
Digest digest.Digest
|
||||
Config []byte
|
||||
AttestationChain *AttestationChain
|
||||
}
|
||||
|
||||
type AttestationChain struct {
|
||||
Root digest.Digest
|
||||
ImageManifest digest.Digest
|
||||
AttestationManifest digest.Digest
|
||||
SignatureManifests []digest.Digest
|
||||
Blobs map[digest.Digest]Blob
|
||||
}
|
||||
|
||||
type Blob struct {
|
||||
Descriptor ocispecs.Descriptor
|
||||
Data []byte
|
||||
}
|
||||
|
||||
type ResolveGitOpt struct {
|
||||
@@ -67,7 +83,8 @@ type ResolveHTTPResponse struct {
|
||||
}
|
||||
|
||||
type ResolveOCILayoutOpt struct {
|
||||
Store ResolveImageConfigOptStore
|
||||
Platform *ocispecs.Platform
|
||||
Store ResolveImageConfigOptStore
|
||||
}
|
||||
|
||||
type ResolveImageConfigOptStore struct {
|
||||
|
||||
+12
-2
@@ -51,6 +51,7 @@ type SolveOpt struct {
|
||||
SessionPreInitialized bool // TODO: refactor to better session syncing
|
||||
Internal bool
|
||||
SourcePolicy *spb.Policy
|
||||
SourcePolicyProvider session.Attachable
|
||||
Ref string
|
||||
}
|
||||
|
||||
@@ -219,6 +220,10 @@ func (c *Client) solve(ctx context.Context, def *llb.Definition, runGateway runG
|
||||
s.Allow(filesync.NewFSSyncTarget(syncTargets...))
|
||||
}
|
||||
|
||||
if opt.SourcePolicyProvider != nil {
|
||||
s.Allow(opt.SourcePolicyProvider)
|
||||
}
|
||||
|
||||
eg.Go(func() error {
|
||||
sd := c.sessionDialer
|
||||
if sd == nil {
|
||||
@@ -275,7 +280,7 @@ func (c *Client) solve(ctx context.Context, def *llb.Definition, runGateway runG
|
||||
})
|
||||
}
|
||||
|
||||
resp, err := c.ControlClient().Solve(ctx, &controlapi.SolveRequest{
|
||||
sopt := &controlapi.SolveRequest{
|
||||
Ref: ref,
|
||||
Definition: pbd,
|
||||
Exporters: exports,
|
||||
@@ -290,7 +295,12 @@ func (c *Client) solve(ctx context.Context, def *llb.Definition, runGateway runG
|
||||
Entitlements: slices.Clone(opt.AllowedEntitlements),
|
||||
Internal: opt.Internal,
|
||||
SourcePolicy: opt.SourcePolicy,
|
||||
})
|
||||
}
|
||||
if opt.SourcePolicyProvider != nil {
|
||||
sopt.SourcePolicySession = s.ID()
|
||||
}
|
||||
|
||||
resp, err := c.ControlClient().Solve(ctx, sopt)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to solve")
|
||||
}
|
||||
|
||||
+4
-4
@@ -94,9 +94,9 @@ func (nc *NamedContext) load(ctx context.Context, count int) (*llb.State, *docke
|
||||
named = reference.TagNameOnly(named)
|
||||
|
||||
ref, dgst, data, err := nc.bc.client.ResolveImageConfig(ctx, named.String(), sourceresolver.Opt{
|
||||
LogName: fmt.Sprintf("[context %s] load metadata for %s", nc.nameWithPlatform, ref),
|
||||
Platform: opt.Platform,
|
||||
LogName: fmt.Sprintf("[context %s] load metadata for %s", nc.nameWithPlatform, ref),
|
||||
ImageOpt: &sourceresolver.ResolveImageOpt{
|
||||
Platform: opt.Platform,
|
||||
ResolveMode: opt.ResolveMode,
|
||||
},
|
||||
})
|
||||
@@ -183,9 +183,9 @@ func (nc *NamedContext) load(ctx context.Context, count int) (*llb.State, *docke
|
||||
}
|
||||
|
||||
_, dgst, data, err := nc.bc.client.ResolveImageConfig(ctx, dummyRef.String(), sourceresolver.Opt{
|
||||
LogName: fmt.Sprintf("[context %s] load metadata for %s", nc.nameWithPlatform, dummyRef.String()),
|
||||
Platform: opt.Platform,
|
||||
LogName: fmt.Sprintf("[context %s] load metadata for %s", nc.nameWithPlatform, dummyRef.String()),
|
||||
OCILayoutOpt: &sourceresolver.ResolveOCILayoutOpt{
|
||||
Platform: opt.Platform,
|
||||
Store: sourceresolver.ResolveImageConfigOptStore{
|
||||
SessionID: nc.bc.bopts.SessionID,
|
||||
StoreID: named.Name(),
|
||||
|
||||
+64
-6
@@ -5,6 +5,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"maps"
|
||||
"net"
|
||||
"os"
|
||||
"strings"
|
||||
@@ -25,6 +26,7 @@ import (
|
||||
"github.com/moby/buildkit/util/imageutil"
|
||||
"github.com/moby/sys/signal"
|
||||
digest "github.com/opencontainers/go-digest"
|
||||
ocispecs "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
"github.com/pkg/errors"
|
||||
fstypes "github.com/tonistiigi/fsutil/types"
|
||||
"golang.org/x/sync/errgroup"
|
||||
@@ -497,8 +499,14 @@ func (c *grpcClient) ResolveSourceMetadata(ctx context.Context, op *opspb.Source
|
||||
}, nil
|
||||
}
|
||||
|
||||
var platform *ocispecs.Platform
|
||||
if imgOpt := opt.ImageOpt; imgOpt != nil && imgOpt.Platform != nil {
|
||||
platform = imgOpt.Platform
|
||||
} else if ociOpt := opt.OCILayoutOpt; ociOpt != nil && ociOpt.Platform != nil {
|
||||
platform = ociOpt.Platform
|
||||
}
|
||||
var p *opspb.Platform
|
||||
if platform := opt.Platform; platform != nil {
|
||||
if platform != nil {
|
||||
p = &opspb.Platform{
|
||||
OS: platform.OS,
|
||||
Architecture: platform.Architecture,
|
||||
@@ -514,6 +522,13 @@ func (c *grpcClient) ResolveSourceMetadata(ctx context.Context, op *opspb.Source
|
||||
LogName: opt.LogName,
|
||||
SourcePolicies: opt.SourcePolicies,
|
||||
}
|
||||
if opt.ImageOpt != nil {
|
||||
req.Image = &pb.ResolveSourceImageRequest{
|
||||
NoConfig: opt.ImageOpt.NoConfig,
|
||||
AttestationChain: opt.ImageOpt.AttestationChain,
|
||||
}
|
||||
}
|
||||
|
||||
if opt.GitOpt != nil {
|
||||
req.Git = &pb.ResolveSourceGitRequest{
|
||||
ReturnObject: opt.GitOpt.ReturnObject,
|
||||
@@ -529,10 +544,7 @@ func (c *grpcClient) ResolveSourceMetadata(ctx context.Context, op *opspb.Source
|
||||
Op: resp.Source,
|
||||
}
|
||||
if resp.Image != nil {
|
||||
r.Image = &sourceresolver.ResolveImageResponse{
|
||||
Digest: digest.Digest(resp.Image.Digest),
|
||||
Config: resp.Image.Config,
|
||||
}
|
||||
r.Image = imgResponseFromPB(resp.Image)
|
||||
}
|
||||
if resp.Git != nil {
|
||||
r.Git = &sourceresolver.ResolveGitResponse{
|
||||
@@ -561,6 +573,45 @@ func (c *grpcClient) ResolveSourceMetadata(ctx context.Context, op *opspb.Source
|
||||
return r, nil
|
||||
}
|
||||
|
||||
func imgResponseFromPB(resp *pb.ResolveSourceImageResponse) *sourceresolver.ResolveImageResponse {
|
||||
r := &sourceresolver.ResolveImageResponse{
|
||||
Digest: digest.Digest(resp.Digest),
|
||||
Config: resp.Config,
|
||||
}
|
||||
if resp.AttestationChain != nil {
|
||||
ac := &sourceresolver.AttestationChain{
|
||||
Root: digest.Digest(resp.AttestationChain.Root),
|
||||
ImageManifest: digest.Digest(resp.AttestationChain.ImageManifest),
|
||||
AttestationManifest: digest.Digest(resp.AttestationChain.AttestationManifest),
|
||||
SignatureManifests: []digest.Digest{},
|
||||
Blobs: map[digest.Digest]sourceresolver.Blob{},
|
||||
}
|
||||
for _, sm := range resp.AttestationChain.SignatureManifests {
|
||||
ac.SignatureManifests = append(ac.SignatureManifests, digest.Digest(sm))
|
||||
}
|
||||
for k, v := range resp.AttestationChain.Blobs {
|
||||
ac.Blobs[digest.Digest(k)] = sourceresolver.Blob{
|
||||
Descriptor: descriptorFromPB(v.GetDescriptor_()),
|
||||
Data: v.Data,
|
||||
}
|
||||
}
|
||||
r.AttestationChain = ac
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
func descriptorFromPB(pbDesc *pb.Descriptor) ocispecs.Descriptor {
|
||||
if pbDesc == nil {
|
||||
return ocispecs.Descriptor{}
|
||||
}
|
||||
return ocispecs.Descriptor{
|
||||
MediaType: pbDesc.GetMediaType(),
|
||||
Size: pbDesc.GetSize(),
|
||||
Digest: digest.Digest(pbDesc.GetDigest()),
|
||||
Annotations: maps.Clone(pbDesc.GetAnnotations()),
|
||||
}
|
||||
}
|
||||
|
||||
func (c *grpcClient) resolveImageConfigViaSourceMetadata(ctx context.Context, ref string, opt sourceresolver.Opt, p *opspb.Platform) (string, digest.Digest, []byte, error) {
|
||||
op := &opspb.SourceOp{
|
||||
Identifier: "docker-image://" + ref,
|
||||
@@ -596,8 +647,15 @@ func (c *grpcClient) resolveImageConfigViaSourceMetadata(ctx context.Context, re
|
||||
}
|
||||
|
||||
func (c *grpcClient) ResolveImageConfig(ctx context.Context, ref string, opt sourceresolver.Opt) (string, digest.Digest, []byte, error) {
|
||||
var platform *ocispecs.Platform
|
||||
if imgOpt := opt.ImageOpt; imgOpt != nil && imgOpt.Platform != nil {
|
||||
platform = imgOpt.Platform
|
||||
} else if ociOpt := opt.OCILayoutOpt; ociOpt != nil && ociOpt.Platform != nil {
|
||||
platform = ociOpt.Platform
|
||||
}
|
||||
|
||||
var p *opspb.Platform
|
||||
if platform := opt.Platform; platform != nil {
|
||||
if platform != nil {
|
||||
p = &opspb.Platform{
|
||||
OS: platform.OS,
|
||||
Architecture: platform.Architecture,
|
||||
|
||||
+574
-268
File diff suppressed because it is too large
Load Diff
+28
-1
@@ -135,8 +135,9 @@ message ResolveSourceMetaRequest {
|
||||
pb.Platform Platform = 2;
|
||||
string LogName = 3;
|
||||
string ResolveMode = 4;
|
||||
repeated moby.buildkit.v1.sourcepolicy.Policy SourcePolicies = 8;
|
||||
ResolveSourceGitRequest Git = 5;
|
||||
ResolveSourceImageRequest Image = 6;
|
||||
repeated moby.buildkit.v1.sourcepolicy.Policy SourcePolicies = 8;
|
||||
}
|
||||
|
||||
message ResolveSourceMetaResponse {
|
||||
@@ -146,9 +147,23 @@ message ResolveSourceMetaResponse {
|
||||
ResolveSourceHTTPResponse HTTP = 4;
|
||||
}
|
||||
|
||||
message ResolveSourceImageRequest {
|
||||
bool NoConfig = 1;
|
||||
bool AttestationChain = 2;
|
||||
}
|
||||
|
||||
message AttestationChain {
|
||||
string Root = 1;
|
||||
string ImageManifest = 2;
|
||||
string AttestationManifest = 3;
|
||||
repeated string SignatureManifests = 4;
|
||||
map<string, Blob> Blobs = 5;
|
||||
}
|
||||
|
||||
message ResolveSourceImageResponse {
|
||||
string Digest = 1;
|
||||
bytes Config = 2;
|
||||
AttestationChain AttestationChain = 3;
|
||||
}
|
||||
|
||||
message ResolveSourceGitRequest {
|
||||
@@ -348,3 +363,15 @@ message SignalMessage {
|
||||
// are platform dependent.
|
||||
string Name = 1;
|
||||
}
|
||||
|
||||
message Blob {
|
||||
Descriptor descriptor = 1;
|
||||
bytes data = 2;
|
||||
}
|
||||
|
||||
message Descriptor {
|
||||
string media_type = 1;
|
||||
string digest = 2;
|
||||
int64 size = 3;
|
||||
map<string, string> annotations = 5;
|
||||
}
|
||||
+1484
File diff suppressed because it is too large
Load Diff
+15
-1
@@ -6,11 +6,17 @@ import (
|
||||
|
||||
"github.com/containerd/containerd/v2/core/content"
|
||||
"github.com/containerd/containerd/v2/core/remotes"
|
||||
digest "github.com/opencontainers/go-digest"
|
||||
ocispecs "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
func FromFetcher(f remotes.Fetcher) content.Provider {
|
||||
type ReferrersProvider interface {
|
||||
content.Provider
|
||||
remotes.ReferrersFetcher
|
||||
}
|
||||
|
||||
func FromFetcher(f remotes.Fetcher) ReferrersProvider {
|
||||
return &fetchedProvider{
|
||||
f: f,
|
||||
}
|
||||
@@ -29,6 +35,14 @@ func (p *fetchedProvider) ReaderAt(ctx context.Context, desc ocispecs.Descriptor
|
||||
return &readerAt{Reader: rc, Closer: rc, size: desc.Size}, nil
|
||||
}
|
||||
|
||||
func (p *fetchedProvider) FetchReferrers(ctx context.Context, dgst digest.Digest, opts ...remotes.FetchReferrersOpt) ([]ocispecs.Descriptor, error) {
|
||||
refs, ok := p.f.(remotes.ReferrersFetcher)
|
||||
if !ok {
|
||||
return nil, errors.Errorf("fetcher does not support referrers")
|
||||
}
|
||||
return refs.FetchReferrers(ctx, dgst, opts...)
|
||||
}
|
||||
|
||||
type readerAt struct {
|
||||
io.Reader
|
||||
io.Closer
|
||||
|
||||
Reference in New Issue
Block a user