mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-09 21:17:09 +08:00
vendor: update buildkit with typed errors support
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
129
vendor/github.com/moby/buildkit/solver/errdefs/errdefs.pb.go
generated
vendored
Normal file
129
vendor/github.com/moby/buildkit/solver/errdefs/errdefs.pb.go
generated
vendored
Normal file
@ -0,0 +1,129 @@
|
||||
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
||||
// source: errdefs.proto
|
||||
|
||||
package errdefs
|
||||
|
||||
import (
|
||||
fmt "fmt"
|
||||
proto "github.com/gogo/protobuf/proto"
|
||||
pb "github.com/moby/buildkit/solver/pb"
|
||||
math "math"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the proto package it is being compiled against.
|
||||
// A compilation error at this line likely means your copy of the
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
|
||||
|
||||
type Vertex struct {
|
||||
Digest string `protobuf:"bytes,1,opt,name=digest,proto3" json:"digest,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Vertex) Reset() { *m = Vertex{} }
|
||||
func (m *Vertex) String() string { return proto.CompactTextString(m) }
|
||||
func (*Vertex) ProtoMessage() {}
|
||||
func (*Vertex) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_689dc58a5060aff5, []int{0}
|
||||
}
|
||||
func (m *Vertex) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_Vertex.Unmarshal(m, b)
|
||||
}
|
||||
func (m *Vertex) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_Vertex.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *Vertex) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_Vertex.Merge(m, src)
|
||||
}
|
||||
func (m *Vertex) XXX_Size() int {
|
||||
return xxx_messageInfo_Vertex.Size(m)
|
||||
}
|
||||
func (m *Vertex) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_Vertex.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_Vertex proto.InternalMessageInfo
|
||||
|
||||
func (m *Vertex) GetDigest() string {
|
||||
if m != nil {
|
||||
return m.Digest
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type Source struct {
|
||||
Info *pb.SourceInfo `protobuf:"bytes,1,opt,name=info,proto3" json:"info,omitempty"`
|
||||
Ranges []*pb.Range `protobuf:"bytes,2,rep,name=ranges,proto3" json:"ranges,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Source) Reset() { *m = Source{} }
|
||||
func (m *Source) String() string { return proto.CompactTextString(m) }
|
||||
func (*Source) ProtoMessage() {}
|
||||
func (*Source) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_689dc58a5060aff5, []int{1}
|
||||
}
|
||||
func (m *Source) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_Source.Unmarshal(m, b)
|
||||
}
|
||||
func (m *Source) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_Source.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (m *Source) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_Source.Merge(m, src)
|
||||
}
|
||||
func (m *Source) XXX_Size() int {
|
||||
return xxx_messageInfo_Source.Size(m)
|
||||
}
|
||||
func (m *Source) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_Source.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_Source proto.InternalMessageInfo
|
||||
|
||||
func (m *Source) GetInfo() *pb.SourceInfo {
|
||||
if m != nil {
|
||||
return m.Info
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Source) GetRanges() []*pb.Range {
|
||||
if m != nil {
|
||||
return m.Ranges
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*Vertex)(nil), "errdefs.Vertex")
|
||||
proto.RegisterType((*Source)(nil), "errdefs.Source")
|
||||
}
|
||||
|
||||
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,
|
||||
}
|
14
vendor/github.com/moby/buildkit/solver/errdefs/errdefs.proto
generated
vendored
Normal file
14
vendor/github.com/moby/buildkit/solver/errdefs/errdefs.proto
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package errdefs;
|
||||
|
||||
import "github.com/moby/buildkit/solver/pb/ops.proto";
|
||||
|
||||
message Vertex {
|
||||
string digest = 1;
|
||||
}
|
||||
|
||||
message Source {
|
||||
pb.SourceInfo info = 1;
|
||||
repeated pb.Range ranges = 2;
|
||||
}
|
3
vendor/github.com/moby/buildkit/solver/errdefs/generate.go
generated
vendored
Normal file
3
vendor/github.com/moby/buildkit/solver/errdefs/generate.go
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
package errdefs
|
||||
|
||||
//go:generate protoc -I=. -I=../../vendor/ -I=../../../../../ --gogo_out=. errdefs.proto
|
128
vendor/github.com/moby/buildkit/solver/errdefs/source.go
generated
vendored
Normal file
128
vendor/github.com/moby/buildkit/solver/errdefs/source.go
generated
vendored
Normal file
@ -0,0 +1,128 @@
|
||||
package errdefs
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"strings"
|
||||
|
||||
pb "github.com/moby/buildkit/solver/pb"
|
||||
"github.com/moby/buildkit/util/grpcerrors"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
func WithSource(err error, src Source) error {
|
||||
if err == nil {
|
||||
return nil
|
||||
}
|
||||
return &ErrorSource{Source: src, error: err}
|
||||
}
|
||||
|
||||
type ErrorSource struct {
|
||||
Source
|
||||
error
|
||||
}
|
||||
|
||||
func (e *ErrorSource) Unwrap() error {
|
||||
return e.error
|
||||
}
|
||||
|
||||
func (e *ErrorSource) ToProto() grpcerrors.TypedErrorProto {
|
||||
return &e.Source
|
||||
}
|
||||
|
||||
func Sources(err error) []*Source {
|
||||
var out []*Source
|
||||
var es *ErrorSource
|
||||
if errors.As(err, &es) {
|
||||
out = Sources(es.Unwrap())
|
||||
out = append(out, &es.Source)
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
func (s *Source) WrapError(err error) error {
|
||||
return &ErrorSource{error: err, Source: *s}
|
||||
}
|
||||
|
||||
func (s *Source) Print(w io.Writer) error {
|
||||
si := s.Info
|
||||
if si == nil {
|
||||
return nil
|
||||
}
|
||||
lines := strings.Split(string(si.Data), "\n")
|
||||
|
||||
start, end, ok := getStartEndLine(s.Ranges)
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
if start > len(lines) || start < 1 {
|
||||
return nil
|
||||
}
|
||||
if end > len(lines) {
|
||||
end = len(lines)
|
||||
}
|
||||
|
||||
pad := 2
|
||||
if end == start {
|
||||
pad = 4
|
||||
}
|
||||
var p int
|
||||
|
||||
prepadStart := start
|
||||
for {
|
||||
if p >= pad {
|
||||
break
|
||||
}
|
||||
if start > 1 {
|
||||
start--
|
||||
p++
|
||||
}
|
||||
if end != len(lines) {
|
||||
end++
|
||||
p++
|
||||
}
|
||||
p++
|
||||
}
|
||||
|
||||
fmt.Fprintf(w, "%s:%d\n--------------------\n", si.Filename, prepadStart)
|
||||
for i := start; i <= end; i++ {
|
||||
pfx := " "
|
||||
if containsLine(s.Ranges, i) {
|
||||
pfx = ">>>"
|
||||
}
|
||||
fmt.Fprintf(w, " %3d | %s %s\n", i, pfx, lines[i-1])
|
||||
}
|
||||
fmt.Fprintf(w, "--------------------\n")
|
||||
return nil
|
||||
}
|
||||
|
||||
func containsLine(rr []*pb.Range, l int) bool {
|
||||
for _, r := range rr {
|
||||
e := r.End.Line
|
||||
if e < r.Start.Line {
|
||||
e = r.Start.Line
|
||||
}
|
||||
if r.Start.Line <= int32(l) && e >= int32(l) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func getStartEndLine(rr []*pb.Range) (start int, end int, ok bool) {
|
||||
first := true
|
||||
for _, r := range rr {
|
||||
e := r.End.Line
|
||||
if e < r.Start.Line {
|
||||
e = r.Start.Line
|
||||
}
|
||||
if first || int(r.Start.Line) < start {
|
||||
start = int(r.Start.Line)
|
||||
}
|
||||
if int(e) > end {
|
||||
end = int(e)
|
||||
}
|
||||
first = false
|
||||
}
|
||||
return start, end, !first
|
||||
}
|
36
vendor/github.com/moby/buildkit/solver/errdefs/vertex.go
generated
vendored
Normal file
36
vendor/github.com/moby/buildkit/solver/errdefs/vertex.go
generated
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
package errdefs
|
||||
|
||||
import (
|
||||
"github.com/containerd/typeurl"
|
||||
"github.com/moby/buildkit/util/grpcerrors"
|
||||
digest "github.com/opencontainers/go-digest"
|
||||
)
|
||||
|
||||
func init() {
|
||||
typeurl.Register((*Vertex)(nil), "github.com/moby/buildkit", "errdefs.Vertex+json")
|
||||
typeurl.Register((*Source)(nil), "github.com/moby/buildkit", "errdefs.Source+json")
|
||||
}
|
||||
|
||||
type VertexError struct {
|
||||
Vertex
|
||||
error
|
||||
}
|
||||
|
||||
func (e *VertexError) Unwrap() error {
|
||||
return e.error
|
||||
}
|
||||
|
||||
func (e *VertexError) ToProto() grpcerrors.TypedErrorProto {
|
||||
return &e.Vertex
|
||||
}
|
||||
|
||||
func WrapVertex(err error, dgst digest.Digest) error {
|
||||
if err == nil {
|
||||
return nil
|
||||
}
|
||||
return &VertexError{Vertex: Vertex{Digest: dgst.String()}, error: err}
|
||||
}
|
||||
|
||||
func (v *Vertex) WrapError(err error) error {
|
||||
return &VertexError{error: err, Vertex: *v}
|
||||
}
|
2
vendor/github.com/moby/buildkit/solver/pb/attr.go
generated
vendored
2
vendor/github.com/moby/buildkit/solver/pb/attr.go
generated
vendored
@ -2,6 +2,8 @@ package pb
|
||||
|
||||
const AttrKeepGitDir = "git.keepgitdir"
|
||||
const AttrFullRemoteURL = "git.fullurl"
|
||||
const AttrAuthHeaderSecret = "git.authheadersecret"
|
||||
const AttrAuthTokenSecret = "git.authtokensecret"
|
||||
const AttrLocalSessionID = "local.session"
|
||||
const AttrLocalUniqueID = "local.unique"
|
||||
const AttrIncludePatterns = "local.includepattern"
|
||||
|
13
vendor/github.com/moby/buildkit/solver/pb/caps.go
generated
vendored
13
vendor/github.com/moby/buildkit/solver/pb/caps.go
generated
vendored
@ -19,9 +19,10 @@ const (
|
||||
CapSourceLocalExcludePatterns apicaps.CapID = "source.local.excludepatterns"
|
||||
CapSourceLocalSharedKeyHint apicaps.CapID = "source.local.sharedkeyhint"
|
||||
|
||||
CapSourceGit apicaps.CapID = "source.git"
|
||||
CapSourceGitKeepDir apicaps.CapID = "source.git.keepgitdir"
|
||||
CapSourceGitFullURL apicaps.CapID = "source.git.fullurl"
|
||||
CapSourceGit apicaps.CapID = "source.git"
|
||||
CapSourceGitKeepDir apicaps.CapID = "source.git.keepgitdir"
|
||||
CapSourceGitFullURL apicaps.CapID = "source.git.fullurl"
|
||||
CapSourceGitHTTPAuth apicaps.CapID = "source.git.httpauth"
|
||||
|
||||
CapSourceHTTP apicaps.CapID = "source.http"
|
||||
CapSourceHTTPChecksum apicaps.CapID = "source.http.checksum"
|
||||
@ -131,6 +132,12 @@ func init() {
|
||||
Status: apicaps.CapStatusExperimental,
|
||||
})
|
||||
|
||||
Caps.Init(apicaps.Cap{
|
||||
ID: CapSourceGitHTTPAuth,
|
||||
Enabled: true,
|
||||
Status: apicaps.CapStatusExperimental,
|
||||
})
|
||||
|
||||
Caps.Init(apicaps.Cap{
|
||||
ID: CapSourceHTTP,
|
||||
Enabled: true,
|
||||
|
1809
vendor/github.com/moby/buildkit/solver/pb/ops.pb.go
generated
vendored
1809
vendor/github.com/moby/buildkit/solver/pb/ops.pb.go
generated
vendored
File diff suppressed because it is too large
Load Diff
40
vendor/github.com/moby/buildkit/solver/pb/ops.proto
generated
vendored
40
vendor/github.com/moby/buildkit/solver/pb/ops.proto
generated
vendored
@ -177,6 +177,42 @@ message OpMetadata {
|
||||
map<string, bool> caps = 5 [(gogoproto.castkey) = "github.com/moby/buildkit/util/apicaps.CapID", (gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
// Source is a source mapping description for a file
|
||||
message Source {
|
||||
map<string, Locations> locations = 1;
|
||||
repeated SourceInfo infos = 2;
|
||||
}
|
||||
|
||||
// Locations is a list of ranges with a index to its source map.
|
||||
message Locations {
|
||||
repeated Location locations = 1;
|
||||
}
|
||||
|
||||
// Source info contains the shared metadata of a source mapping
|
||||
message SourceInfo {
|
||||
string filename = 1;
|
||||
bytes data = 2;
|
||||
Definition definition = 3;
|
||||
}
|
||||
|
||||
// Location defines list of areas in to source file
|
||||
message Location {
|
||||
int32 sourceIndex = 1;
|
||||
repeated Range ranges = 2;
|
||||
}
|
||||
|
||||
// Range is an area in the source file
|
||||
message Range {
|
||||
Position start = 1 [(gogoproto.nullable) = false];
|
||||
Position end = 2 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
// Position is single location in a source file
|
||||
message Position {
|
||||
int32 Line = 1;
|
||||
int32 Character = 2;
|
||||
}
|
||||
|
||||
message ExportCache {
|
||||
bool Value = 1;
|
||||
}
|
||||
@ -200,6 +236,8 @@ message Definition {
|
||||
// metadata contains metadata for the each of the Op messages.
|
||||
// A key must be an LLB op digest string. Currently, empty string is not expected as a key, but it may change in the future.
|
||||
map<string, OpMetadata> metadata = 2 [(gogoproto.castkey) = "github.com/opencontainers/go-digest.Digest", (gogoproto.nullable) = false];
|
||||
// Source contains the source mapping information for the vertexes in the definition
|
||||
Source Source = 3;
|
||||
}
|
||||
|
||||
message HostIP {
|
||||
@ -302,4 +340,4 @@ message UserOpt {
|
||||
message NamedUserOpt {
|
||||
string name = 1;
|
||||
int64 input = 2 [(gogoproto.customtype) = "InputIndex", (gogoproto.nullable) = false];
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user