vendor: update buildkit to v0.8

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
Tonis Tiigi
2020-12-07 22:01:24 -08:00
parent 080e9981c7
commit 69a1419ab1
323 changed files with 20129 additions and 8394 deletions

View File

@ -0,0 +1,13 @@
package errdefs
import (
"context"
"errors"
"github.com/moby/buildkit/util/grpcerrors"
"google.golang.org/grpc/codes"
)
func IsCanceled(err error) bool {
return errors.Is(err, context.Canceled) || grpcerrors.Code(err) == codes.Canceled
}

View File

@ -105,25 +105,295 @@ func (m *Source) GetRanges() []*pb.Range {
return nil
}
type FrontendCap struct {
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *FrontendCap) Reset() { *m = FrontendCap{} }
func (m *FrontendCap) String() string { return proto.CompactTextString(m) }
func (*FrontendCap) ProtoMessage() {}
func (*FrontendCap) Descriptor() ([]byte, []int) {
return fileDescriptor_689dc58a5060aff5, []int{2}
}
func (m *FrontendCap) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_FrontendCap.Unmarshal(m, b)
}
func (m *FrontendCap) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_FrontendCap.Marshal(b, m, deterministic)
}
func (m *FrontendCap) XXX_Merge(src proto.Message) {
xxx_messageInfo_FrontendCap.Merge(m, src)
}
func (m *FrontendCap) XXX_Size() int {
return xxx_messageInfo_FrontendCap.Size(m)
}
func (m *FrontendCap) XXX_DiscardUnknown() {
xxx_messageInfo_FrontendCap.DiscardUnknown(m)
}
var xxx_messageInfo_FrontendCap proto.InternalMessageInfo
func (m *FrontendCap) GetName() string {
if m != nil {
return m.Name
}
return ""
}
type Subrequest struct {
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *Subrequest) Reset() { *m = Subrequest{} }
func (m *Subrequest) String() string { return proto.CompactTextString(m) }
func (*Subrequest) ProtoMessage() {}
func (*Subrequest) Descriptor() ([]byte, []int) {
return fileDescriptor_689dc58a5060aff5, []int{3}
}
func (m *Subrequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Subrequest.Unmarshal(m, b)
}
func (m *Subrequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Subrequest.Marshal(b, m, deterministic)
}
func (m *Subrequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_Subrequest.Merge(m, src)
}
func (m *Subrequest) XXX_Size() int {
return xxx_messageInfo_Subrequest.Size(m)
}
func (m *Subrequest) XXX_DiscardUnknown() {
xxx_messageInfo_Subrequest.DiscardUnknown(m)
}
var xxx_messageInfo_Subrequest proto.InternalMessageInfo
func (m *Subrequest) GetName() string {
if m != nil {
return m.Name
}
return ""
}
type Solve struct {
InputIDs []string `protobuf:"bytes,1,rep,name=inputIDs,proto3" json:"inputIDs,omitempty"`
MountIDs []string `protobuf:"bytes,2,rep,name=mountIDs,proto3" json:"mountIDs,omitempty"`
Op *pb.Op `protobuf:"bytes,3,opt,name=op,proto3" json:"op,omitempty"`
// Types that are valid to be assigned to Subject:
// *Solve_File
// *Solve_Cache
Subject isSolve_Subject `protobuf_oneof:"subject"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *Solve) Reset() { *m = Solve{} }
func (m *Solve) String() string { return proto.CompactTextString(m) }
func (*Solve) ProtoMessage() {}
func (*Solve) Descriptor() ([]byte, []int) {
return fileDescriptor_689dc58a5060aff5, []int{4}
}
func (m *Solve) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Solve.Unmarshal(m, b)
}
func (m *Solve) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Solve.Marshal(b, m, deterministic)
}
func (m *Solve) XXX_Merge(src proto.Message) {
xxx_messageInfo_Solve.Merge(m, src)
}
func (m *Solve) XXX_Size() int {
return xxx_messageInfo_Solve.Size(m)
}
func (m *Solve) XXX_DiscardUnknown() {
xxx_messageInfo_Solve.DiscardUnknown(m)
}
var xxx_messageInfo_Solve proto.InternalMessageInfo
type isSolve_Subject interface {
isSolve_Subject()
}
type Solve_File struct {
File *FileAction `protobuf:"bytes,4,opt,name=file,proto3,oneof" json:"file,omitempty"`
}
type Solve_Cache struct {
Cache *ContentCache `protobuf:"bytes,5,opt,name=cache,proto3,oneof" json:"cache,omitempty"`
}
func (*Solve_File) isSolve_Subject() {}
func (*Solve_Cache) isSolve_Subject() {}
func (m *Solve) GetSubject() isSolve_Subject {
if m != nil {
return m.Subject
}
return nil
}
func (m *Solve) GetInputIDs() []string {
if m != nil {
return m.InputIDs
}
return nil
}
func (m *Solve) GetMountIDs() []string {
if m != nil {
return m.MountIDs
}
return nil
}
func (m *Solve) GetOp() *pb.Op {
if m != nil {
return m.Op
}
return nil
}
func (m *Solve) GetFile() *FileAction {
if x, ok := m.GetSubject().(*Solve_File); ok {
return x.File
}
return nil
}
func (m *Solve) GetCache() *ContentCache {
if x, ok := m.GetSubject().(*Solve_Cache); ok {
return x.Cache
}
return nil
}
// XXX_OneofWrappers is for the internal use of the proto package.
func (*Solve) XXX_OneofWrappers() []interface{} {
return []interface{}{
(*Solve_File)(nil),
(*Solve_Cache)(nil),
}
}
type FileAction struct {
// Index of the file action that failed the exec.
Index int64 `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *FileAction) Reset() { *m = FileAction{} }
func (m *FileAction) String() string { return proto.CompactTextString(m) }
func (*FileAction) ProtoMessage() {}
func (*FileAction) Descriptor() ([]byte, []int) {
return fileDescriptor_689dc58a5060aff5, []int{5}
}
func (m *FileAction) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_FileAction.Unmarshal(m, b)
}
func (m *FileAction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_FileAction.Marshal(b, m, deterministic)
}
func (m *FileAction) XXX_Merge(src proto.Message) {
xxx_messageInfo_FileAction.Merge(m, src)
}
func (m *FileAction) XXX_Size() int {
return xxx_messageInfo_FileAction.Size(m)
}
func (m *FileAction) XXX_DiscardUnknown() {
xxx_messageInfo_FileAction.DiscardUnknown(m)
}
var xxx_messageInfo_FileAction proto.InternalMessageInfo
func (m *FileAction) GetIndex() int64 {
if m != nil {
return m.Index
}
return 0
}
type ContentCache struct {
// Original index of result that failed the slow cache calculation.
Index int64 `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ContentCache) Reset() { *m = ContentCache{} }
func (m *ContentCache) String() string { return proto.CompactTextString(m) }
func (*ContentCache) ProtoMessage() {}
func (*ContentCache) Descriptor() ([]byte, []int) {
return fileDescriptor_689dc58a5060aff5, []int{6}
}
func (m *ContentCache) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ContentCache.Unmarshal(m, b)
}
func (m *ContentCache) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ContentCache.Marshal(b, m, deterministic)
}
func (m *ContentCache) XXX_Merge(src proto.Message) {
xxx_messageInfo_ContentCache.Merge(m, src)
}
func (m *ContentCache) XXX_Size() int {
return xxx_messageInfo_ContentCache.Size(m)
}
func (m *ContentCache) XXX_DiscardUnknown() {
xxx_messageInfo_ContentCache.DiscardUnknown(m)
}
var xxx_messageInfo_ContentCache proto.InternalMessageInfo
func (m *ContentCache) GetIndex() int64 {
if m != nil {
return m.Index
}
return 0
}
func init() {
proto.RegisterType((*Vertex)(nil), "errdefs.Vertex")
proto.RegisterType((*Source)(nil), "errdefs.Source")
proto.RegisterType((*FrontendCap)(nil), "errdefs.FrontendCap")
proto.RegisterType((*Subrequest)(nil), "errdefs.Subrequest")
proto.RegisterType((*Solve)(nil), "errdefs.Solve")
proto.RegisterType((*FileAction)(nil), "errdefs.FileAction")
proto.RegisterType((*ContentCache)(nil), "errdefs.ContentCache")
}
func init() { proto.RegisterFile("errdefs.proto", fileDescriptor_689dc58a5060aff5) }
var fileDescriptor_689dc58a5060aff5 = []byte{
// 177 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x2c, 0xcd, 0xc1, 0x8a, 0x83, 0x30,
0x10, 0x80, 0x61, 0xdc, 0x5d, 0xb2, 0x18, 0xd9, 0x3d, 0xe4, 0x50, 0xa4, 0x27, 0xeb, 0xc9, 0x43,
0x49, 0xc0, 0x3e, 0x45, 0x4f, 0x85, 0x14, 0x7a, 0x6f, 0x74, 0xb4, 0xa1, 0xea, 0x84, 0x49, 0x2c,
0xed, 0xdb, 0x17, 0x6d, 0x8e, 0xff, 0x7c, 0x33, 0x0c, 0xff, 0x03, 0xa2, 0x16, 0x3a, 0x2f, 0x1d,
0x61, 0x40, 0xf1, 0x1b, 0x73, 0xbb, 0xef, 0x6d, 0xb8, 0xcd, 0x46, 0x36, 0x38, 0xaa, 0x11, 0xcd,
0x4b, 0x99, 0xd9, 0x0e, 0xed, 0xdd, 0x06, 0xe5, 0x71, 0x78, 0x00, 0x29, 0x67, 0x14, 0xba, 0x78,
0x56, 0x16, 0x9c, 0x5d, 0x80, 0x02, 0x3c, 0xc5, 0x86, 0xb3, 0xd6, 0xf6, 0xe0, 0x43, 0x9e, 0x14,
0x49, 0x95, 0xea, 0x58, 0xe5, 0x89, 0xb3, 0x33, 0xce, 0xd4, 0x80, 0x28, 0xf9, 0x8f, 0x9d, 0x3a,
0x5c, 0x3d, 0xab, 0xff, 0xa5, 0x33, 0xf2, 0x23, 0xc7, 0xa9, 0x43, 0xbd, 0x9a, 0xd8, 0x71, 0x46,
0xd7, 0xa9, 0x07, 0x9f, 0x7f, 0x15, 0xdf, 0x55, 0x56, 0xa7, 0xcb, 0x96, 0x5e, 0x26, 0x3a, 0x82,
0x61, 0xeb, 0xe7, 0xc3, 0x3b, 0x00, 0x00, 0xff, 0xff, 0x93, 0xb5, 0x8b, 0x2a, 0xc1, 0x00, 0x00,
0x00,
// 348 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x91, 0xcd, 0x8e, 0xd3, 0x30,
0x14, 0x85, 0x27, 0xbf, 0x43, 0x6e, 0x81, 0x85, 0x81, 0x51, 0x34, 0xab, 0x8c, 0xc5, 0xa2, 0x48,
0x90, 0x48, 0xc3, 0x13, 0x40, 0xd1, 0x68, 0x66, 0x55, 0xc9, 0x95, 0xd8, 0xc7, 0xc9, 0x4d, 0x6b,
0x48, 0x6c, 0xe3, 0xd8, 0xa8, 0xbc, 0x1b, 0x0f, 0x87, 0xe2, 0xa4, 0x65, 0x16, 0xdd, 0xe5, 0xe4,
0xfb, 0x7c, 0xed, 0x63, 0xc3, 0x2b, 0x34, 0xa6, 0xc5, 0x6e, 0x2c, 0xb5, 0x51, 0x56, 0x91, 0xeb,
0x25, 0xde, 0x7e, 0xdc, 0x0b, 0x7b, 0x70, 0xbc, 0x6c, 0xd4, 0x50, 0x0d, 0x8a, 0xff, 0xa9, 0xb8,
0x13, 0x7d, 0xfb, 0x53, 0xd8, 0x6a, 0x54, 0xfd, 0x6f, 0x34, 0x95, 0xe6, 0x95, 0xd2, 0xcb, 0x32,
0x5a, 0x40, 0xfa, 0x1d, 0x8d, 0xc5, 0x23, 0xb9, 0x81, 0xb4, 0x15, 0x7b, 0x1c, 0x6d, 0x1e, 0x14,
0xc1, 0x3a, 0x63, 0x4b, 0xa2, 0x5b, 0x48, 0x77, 0xca, 0x99, 0x06, 0x09, 0x85, 0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 0x78, 0xf9, 0x7c, 0xce, 0x65, 0x8b, 0xa7, 0xfe, 0x1d, 0x3f, 0xff, 0x0b,
0x00, 0x00, 0xff, 0xff, 0x1e, 0xfa, 0x9c, 0x6f, 0x0f, 0x02, 0x00, 0x00,
}

View File

@ -12,3 +12,32 @@ message Source {
pb.SourceInfo info = 1;
repeated pb.Range ranges = 2;
}
message FrontendCap {
string name = 1;
}
message Subrequest {
string name = 1;
}
message Solve {
repeated string inputIDs = 1;
repeated string mountIDs = 2;
pb.Op op = 3;
oneof subject {
FileAction file = 4;
ContentCache cache = 5;
}
}
message FileAction {
// Index of the file action that failed the exec.
int64 index = 1;
}
message ContentCache {
// Original index of result that failed the slow cache calculation.
int64 index = 1;
}

34
vendor/github.com/moby/buildkit/solver/errdefs/exit.go generated vendored Normal file
View File

@ -0,0 +1,34 @@
package errdefs
import "fmt"
const (
// ContainerdUnknownExitStatus is returned when containerd is unable to
// determine the exit status of a process. This can happen if the process never starts
// or if an error was encountered when obtaining the exit status, it is set to 255.
//
// This const is defined here to prevent importing github.com/containerd/containerd
// and corresponds with https://github.com/containerd/containerd/blob/40b22ef0741028917761d8c5d5d29e0d19038836/task.go#L52-L55
ContainerdUnknownExitStatus = 255
)
// ExitError will be returned when the container process exits with a non-zero
// exit code.
type ExitError struct {
ExitCode uint32
Err error
}
func (err *ExitError) Error() string {
if err.Err != nil {
return err.Err.Error()
}
return fmt.Sprintf("exit code: %d", err.ExitCode)
}
func (err *ExitError) Unwrap() error {
if err.Err == nil {
return fmt.Errorf("exit code: %d", err.ExitCode)
}
return err.Err
}

View File

@ -0,0 +1,41 @@
package errdefs
import (
fmt "fmt"
"github.com/containerd/typeurl"
"github.com/moby/buildkit/util/grpcerrors"
)
func init() {
typeurl.Register((*FrontendCap)(nil), "github.com/moby/buildkit", "errdefs.FrontendCap+json")
}
type UnsupportedFrontendCapError struct {
FrontendCap
error
}
func (e *UnsupportedFrontendCapError) Error() string {
msg := fmt.Sprintf("unsupported frontend capability %s", e.FrontendCap.Name)
if e.error != nil {
msg += ": " + e.error.Error()
}
return msg
}
func (e *UnsupportedFrontendCapError) Unwrap() error {
return e.error
}
func (e *UnsupportedFrontendCapError) ToProto() grpcerrors.TypedErrorProto {
return &e.FrontendCap
}
func NewUnsupportedFrontendCapError(name string) error {
return &UnsupportedFrontendCapError{FrontendCap: FrontendCap{Name: name}}
}
func (v *FrontendCap) WrapError(err error) error {
return &UnsupportedFrontendCapError{error: err, FrontendCap: *v}
}

20
vendor/github.com/moby/buildkit/solver/errdefs/op.go generated vendored Normal file
View File

@ -0,0 +1,20 @@
package errdefs
import "github.com/moby/buildkit/solver/pb"
type OpError struct {
error
Op *pb.Op
}
func (e *OpError) Unwrap() error {
return e.error
}
func WithOp(err error, iface interface{}) error {
op, ok := iface.(*pb.Op)
if err == nil || !ok {
return err
}
return &OpError{error: err, Op: op}
}

View File

@ -0,0 +1,74 @@
package errdefs
import (
"bytes"
"errors"
"github.com/containerd/typeurl"
"github.com/golang/protobuf/jsonpb"
"github.com/moby/buildkit/solver/pb"
"github.com/moby/buildkit/util/grpcerrors"
)
func init() {
typeurl.Register((*Solve)(nil), "github.com/moby/buildkit", "errdefs.Solve+json")
}
//nolint:golint
type IsSolve_Subject isSolve_Subject
// SolveError will be returned when an error is encountered during a solve that
// has an exec op.
type SolveError struct {
Solve
Err error
}
func (e *SolveError) Error() string {
return e.Err.Error()
}
func (e *SolveError) Unwrap() error {
return e.Err
}
func (e *SolveError) ToProto() grpcerrors.TypedErrorProto {
return &e.Solve
}
func WithSolveError(err error, subject IsSolve_Subject, inputIDs, mountIDs []string) error {
if err == nil {
return nil
}
var (
oe *OpError
op *pb.Op
)
if errors.As(err, &oe) {
op = oe.Op
}
return &SolveError{
Err: err,
Solve: Solve{
InputIDs: inputIDs,
MountIDs: mountIDs,
Op: op,
Subject: subject,
},
}
}
func (v *Solve) WrapError(err error) error {
return &SolveError{Err: err, Solve: *v}
}
func (v *Solve) MarshalJSON() ([]byte, error) {
m := jsonpb.Marshaler{}
buf := new(bytes.Buffer)
err := m.Marshal(buf, v)
return buf.Bytes(), err
}
func (v *Solve) UnmarshalJSON(b []byte) error {
return jsonpb.Unmarshal(bytes.NewReader(b), v)
}

View File

@ -0,0 +1,41 @@
package errdefs
import (
fmt "fmt"
"github.com/containerd/typeurl"
"github.com/moby/buildkit/util/grpcerrors"
)
func init() {
typeurl.Register((*Subrequest)(nil), "github.com/moby/buildkit", "errdefs.Subrequest+json")
}
type UnsupportedSubrequestError struct {
Subrequest
error
}
func (e *UnsupportedSubrequestError) Error() string {
msg := fmt.Sprintf("unsupported request %s", e.Subrequest.Name)
if e.error != nil {
msg += ": " + e.error.Error()
}
return msg
}
func (e *UnsupportedSubrequestError) Unwrap() error {
return e.error
}
func (e *UnsupportedSubrequestError) ToProto() grpcerrors.TypedErrorProto {
return &e.Subrequest
}
func NewUnsupportedSubrequestError(name string) error {
return &UnsupportedSubrequestError{Subrequest: Subrequest{Name: name}}
}
func (v *Subrequest) WrapError(err error) error {
return &UnsupportedSubrequestError{error: err, Subrequest: *v}
}