vendor: github.com/moby/buildkit v0.22.0-rc1
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
+2
-1
@@ -151,7 +151,8 @@ func New(ctx context.Context, address string, opts ...ClientOpt) (*Client, error
|
||||
gopts = append(gopts, grpc.WithStreamInterceptor(grpcerrors.StreamClientInterceptor))
|
||||
gopts = append(gopts, customDialOptions...)
|
||||
|
||||
//nolint:staticcheck // ignore SA1019 NewClient has different behavior and needs to be tested
|
||||
// ignore SA1019 NewClient has different behavior and needs to be tested
|
||||
//nolint:staticcheck
|
||||
conn, err := grpc.DialContext(ctx, address, gopts...)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "failed to dial %q . make sure buildkitd is running", address)
|
||||
|
||||
+4
-7
@@ -1,8 +1,9 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
"cmp"
|
||||
"context"
|
||||
"sort"
|
||||
"slices"
|
||||
"time"
|
||||
|
||||
controlapi "github.com/moby/buildkit/api/services/control"
|
||||
@@ -60,13 +61,9 @@ func (c *Client) DiskUsage(ctx context.Context, opts ...DiskUsageOption) ([]*Usa
|
||||
})
|
||||
}
|
||||
|
||||
sort.Slice(du, func(i, j int) bool {
|
||||
if du[i].Size == du[j].Size {
|
||||
return du[i].ID > du[j].ID
|
||||
}
|
||||
return du[i].Size > du[j].Size
|
||||
slices.SortFunc(du, func(a, b *UsageInfo) int {
|
||||
return cmp.Or(cmp.Compare(a.Size, b.Size), cmp.Compare(a.ID, b.ID))
|
||||
})
|
||||
|
||||
return du, nil
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -240,7 +240,7 @@ func (d *DefinitionOp) Inputs() []Output {
|
||||
d.mu.Unlock()
|
||||
|
||||
inputs = append(inputs, &output{vertex: vtx, platform: platform, getIndex: func() (pb.OutputIndex, error) {
|
||||
return pb.OutputIndex(vtx.index), nil
|
||||
return vtx.index, nil
|
||||
}})
|
||||
}
|
||||
|
||||
|
||||
+11
-9
@@ -5,7 +5,7 @@ import (
|
||||
_ "crypto/sha256" // for opencontainers/go-digest
|
||||
"fmt"
|
||||
"net"
|
||||
"sort"
|
||||
"slices"
|
||||
"strings"
|
||||
|
||||
"github.com/moby/buildkit/solver/pb"
|
||||
@@ -143,8 +143,8 @@ func (e *ExecOp) Marshal(ctx context.Context, c *Constraints) (digest.Digest, []
|
||||
return "", nil, nil, nil, err
|
||||
}
|
||||
// make sure mounts are sorted
|
||||
sort.Slice(e.mounts, func(i, j int) bool {
|
||||
return e.mounts[i].target < e.mounts[j].target
|
||||
slices.SortFunc(e.mounts, func(a, b *mount) int {
|
||||
return strings.Compare(a.target, b.target)
|
||||
})
|
||||
|
||||
env, err := getEnv(e.base)(ctx, c)
|
||||
@@ -170,7 +170,10 @@ func (e *ExecOp) Marshal(ctx context.Context, c *Constraints) (digest.Digest, []
|
||||
} else if e.constraints.Platform != nil {
|
||||
os = e.constraints.Platform.OS
|
||||
}
|
||||
env = env.SetDefault("PATH", system.DefaultPathEnv(os))
|
||||
// don't set PATH on Windows. #5445
|
||||
if os != "windows" {
|
||||
env = env.SetDefault("PATH", system.DefaultPathEnv(os))
|
||||
}
|
||||
} else {
|
||||
addCap(&e.constraints, pb.CapExecMetaSetsDefaultPath)
|
||||
}
|
||||
@@ -477,10 +480,9 @@ func (e *ExecOp) Inputs() (inputs []Output) {
|
||||
// make sure mounts are sorted
|
||||
// the same sort occurs in (*ExecOp).Marshal, and this
|
||||
// sort must be the same
|
||||
sort.Slice(e.mounts, func(i int, j int) bool {
|
||||
return e.mounts[i].target < e.mounts[j].target
|
||||
slices.SortFunc(e.mounts, func(a, b *mount) int {
|
||||
return strings.Compare(a.target, b.target)
|
||||
})
|
||||
|
||||
seen := map[Output]struct{}{}
|
||||
for _, m := range e.mounts {
|
||||
if m.source != nil {
|
||||
@@ -497,8 +499,8 @@ func (e *ExecOp) Inputs() (inputs []Output) {
|
||||
func (e *ExecOp) getMountIndexFn(m *mount) func() (pb.OutputIndex, error) {
|
||||
return func() (pb.OutputIndex, error) {
|
||||
// make sure mounts are sorted
|
||||
sort.Slice(e.mounts, func(i, j int) bool {
|
||||
return e.mounts[i].target < e.mounts[j].target
|
||||
slices.SortFunc(e.mounts, func(a, b *mount) int {
|
||||
return strings.Compare(a.target, b.target)
|
||||
})
|
||||
|
||||
i := 0
|
||||
|
||||
+2
-2
@@ -136,7 +136,7 @@ func Image(ref string, opts ...ImageOption) State {
|
||||
} else if info.metaResolver != nil {
|
||||
if _, ok := r.(reference.Digested); ok || !info.resolveDigest {
|
||||
return NewState(src.Output()).Async(func(ctx context.Context, st State, c *Constraints) (State, error) {
|
||||
p := info.Constraints.Platform
|
||||
p := info.Platform
|
||||
if p == nil {
|
||||
p = c.Platform
|
||||
}
|
||||
@@ -153,7 +153,7 @@ func Image(ref string, opts ...ImageOption) State {
|
||||
})
|
||||
}
|
||||
return Scratch().Async(func(ctx context.Context, _ State, c *Constraints) (State, error) {
|
||||
p := info.Constraints.Platform
|
||||
p := info.Platform
|
||||
if p == nil {
|
||||
p = c.Platform
|
||||
}
|
||||
|
||||
+4
-4
@@ -18,9 +18,9 @@ func (c *Client) Prune(ctx context.Context, ch chan UsageInfo, opts ...PruneOpti
|
||||
req := &controlapi.PruneRequest{
|
||||
Filter: info.Filter,
|
||||
KeepDuration: int64(info.KeepDuration),
|
||||
ReservedSpace: int64(info.ReservedSpace),
|
||||
MaxUsedSpace: int64(info.MaxUsedSpace),
|
||||
MinFreeSpace: int64(info.MinFreeSpace),
|
||||
ReservedSpace: info.ReservedSpace,
|
||||
MaxUsedSpace: info.MaxUsedSpace,
|
||||
MinFreeSpace: info.MinFreeSpace,
|
||||
}
|
||||
if info.All {
|
||||
req.All = true
|
||||
@@ -33,7 +33,7 @@ func (c *Client) Prune(ctx context.Context, ch chan UsageInfo, opts ...PruneOpti
|
||||
for {
|
||||
d, err := cl.Recv()
|
||||
if err != nil {
|
||||
if err == io.EOF {
|
||||
if errors.Is(err, io.EOF) {
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
|
||||
+3
-4
@@ -322,7 +322,7 @@ func (c *Client) solve(ctx context.Context, def *llb.Definition, runGateway runG
|
||||
for {
|
||||
resp, err := stream.Recv()
|
||||
if err != nil {
|
||||
if err == io.EOF {
|
||||
if errors.Is(err, io.EOF) {
|
||||
return nil
|
||||
}
|
||||
return errors.Wrap(err, "failed to receive status")
|
||||
@@ -356,7 +356,7 @@ func (c *Client) solve(ctx context.Context, def *llb.Definition, runGateway runG
|
||||
return nil, err
|
||||
}
|
||||
var manifestDesc ocispecs.Descriptor
|
||||
if err = json.Unmarshal([]byte(manifestDescDt), &manifestDesc); err != nil {
|
||||
if err = json.Unmarshal(manifestDescDt, &manifestDesc); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, storePath := range storesToUpdate {
|
||||
@@ -402,8 +402,7 @@ func prepareSyncedFiles(def *llb.Definition, localMounts map[string]fsutil.FS) (
|
||||
return nil, errors.Wrap(err, "failed to parse llb proto op")
|
||||
}
|
||||
if src := op.GetSource(); src != nil {
|
||||
if strings.HasPrefix(src.Identifier, "local://") {
|
||||
name := strings.TrimPrefix(src.Identifier, "local://")
|
||||
if name, ok := strings.CutPrefix(src.Identifier, "local://"); ok {
|
||||
mount, ok := localMounts[name]
|
||||
if !ok {
|
||||
return nil, errors.Errorf("local directory %s not enabled", name)
|
||||
|
||||
+2
-2
@@ -104,7 +104,7 @@ type NetworkConfig struct {
|
||||
type OCIConfig struct {
|
||||
Enabled *bool `toml:"enabled"`
|
||||
Labels map[string]string `toml:"labels"`
|
||||
Platforms []string `toml:"platforms"`
|
||||
Platforms []string `toml:"platforms,omitempty"`
|
||||
Snapshotter string `toml:"snapshotter"`
|
||||
Rootless bool `toml:"rootless"`
|
||||
NoProcessSandbox bool `toml:"noProcessSandbox"`
|
||||
@@ -138,7 +138,7 @@ type ContainerdConfig struct {
|
||||
Address string `toml:"address"`
|
||||
Enabled *bool `toml:"enabled"`
|
||||
Labels map[string]string `toml:"labels"`
|
||||
Platforms []string `toml:"platforms"`
|
||||
Platforms []string `toml:"platforms,omitempty"`
|
||||
Namespace string `toml:"namespace"`
|
||||
Runtime ContainerdRuntime `toml:"runtime"`
|
||||
GCConfig
|
||||
|
||||
+5
-5
@@ -5,13 +5,13 @@ import (
|
||||
"syscall"
|
||||
)
|
||||
|
||||
type internalErr struct {
|
||||
type internalError struct {
|
||||
error
|
||||
}
|
||||
|
||||
func (internalErr) System() {}
|
||||
func (internalError) System() {}
|
||||
|
||||
func (err internalErr) Unwrap() error {
|
||||
func (err internalError) Unwrap() error {
|
||||
return err.error
|
||||
}
|
||||
|
||||
@@ -19,13 +19,13 @@ type system interface {
|
||||
System()
|
||||
}
|
||||
|
||||
var _ system = internalErr{}
|
||||
var _ system = internalError{}
|
||||
|
||||
func Internal(err error) error {
|
||||
if err == nil {
|
||||
return nil
|
||||
}
|
||||
return internalErr{err}
|
||||
return internalError{err}
|
||||
}
|
||||
|
||||
func IsInternal(err error) bool {
|
||||
|
||||
+4
-4
@@ -43,12 +43,12 @@ func Validate(values map[string]map[string]string) (map[string]map[string]string
|
||||
func Parse(values map[string]string) (map[string]map[string]string, error) {
|
||||
attests := make(map[string]string)
|
||||
for k, v := range values {
|
||||
if strings.HasPrefix(k, "attest:") {
|
||||
attests[strings.ToLower(strings.TrimPrefix(k, "attest:"))] = v
|
||||
if after, ok := strings.CutPrefix(k, "attest:"); ok {
|
||||
attests[strings.ToLower(after)] = v
|
||||
continue
|
||||
}
|
||||
if strings.HasPrefix(k, "build-arg:BUILDKIT_ATTEST_") {
|
||||
attests[strings.ToLower(strings.TrimPrefix(k, "build-arg:BUILDKIT_ATTEST_"))] = v
|
||||
if after, ok := strings.CutPrefix(k, "build-arg:BUILDKIT_ATTEST_"); ok {
|
||||
attests[strings.ToLower(after)] = v
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -55,7 +55,7 @@ func (lc *Linter) Run(rule LinterRuleI, location []parser.Range, txt ...string)
|
||||
rulename := rule.RuleName()
|
||||
if rule.IsExperimental() {
|
||||
_, experimentalOk := lc.ExperimentalRules[rulename]
|
||||
if !(lc.ExperimentalAll || experimentalOk) {
|
||||
if !lc.ExperimentalAll && !experimentalOk {
|
||||
return
|
||||
}
|
||||
} else {
|
||||
|
||||
+5
-5
@@ -5,14 +5,14 @@ import (
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// ErrorLocation gives a location in source code that caused the error
|
||||
type ErrorLocation struct {
|
||||
// LocationError gives a location in source code that caused the error
|
||||
type LocationError struct {
|
||||
Locations [][]Range
|
||||
error
|
||||
}
|
||||
|
||||
// Unwrap unwraps to the next error
|
||||
func (e *ErrorLocation) Unwrap() error {
|
||||
func (e *LocationError) Unwrap() error {
|
||||
return e.error
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ func setLocation(err error, location []Range, add bool) error {
|
||||
if err == nil {
|
||||
return nil
|
||||
}
|
||||
var el *ErrorLocation
|
||||
var el *LocationError
|
||||
if errors.As(err, &el) {
|
||||
if add {
|
||||
el.Locations = append(el.Locations, location)
|
||||
@@ -54,7 +54,7 @@ func setLocation(err error, location []Range, add bool) error {
|
||||
}
|
||||
return err
|
||||
}
|
||||
return stack.Enable(&ErrorLocation{
|
||||
return stack.Enable(&LocationError{
|
||||
error: err,
|
||||
Locations: [][]Range{location},
|
||||
})
|
||||
|
||||
+2
-2
@@ -318,7 +318,7 @@ func parseMaybeJSON(rest string, d *directives) (*Node, map[string]bool, error)
|
||||
if err == nil {
|
||||
return node, attrs, nil
|
||||
}
|
||||
if err == errDockerfileNotStringArray {
|
||||
if errors.Is(err, errDockerfileNotStringArray) {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
@@ -336,7 +336,7 @@ func parseMaybeJSONToList(rest string, d *directives) (*Node, map[string]bool, e
|
||||
if err == nil {
|
||||
return node, attrs, nil
|
||||
}
|
||||
if err == errDockerfileNotStringArray {
|
||||
if errors.Is(err, errDockerfileNotStringArray) {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -114,7 +114,7 @@ type Heredoc struct {
|
||||
var (
|
||||
dispatch map[string]func(string, *directives) (*Node, map[string]bool, error)
|
||||
reWhitespace = regexp.MustCompile(`[\t\v\f\r ]+`)
|
||||
reHeredoc = regexp.MustCompile(`^(\d*)<<(-?)([^<]*)$`)
|
||||
reHeredoc = regexp.MustCompile(`^(\d*)<<(-?)\s*([^<]*)$`)
|
||||
reLeadingTabs = regexp.MustCompile(`(?m)^\t+`)
|
||||
)
|
||||
|
||||
@@ -556,8 +556,8 @@ func scanLines(data []byte, atEOF bool) (advance int, token []byte, err error) {
|
||||
}
|
||||
|
||||
func handleScannerError(err error) error {
|
||||
switch err {
|
||||
case bufio.ErrTooLong:
|
||||
switch {
|
||||
case errors.Is(err, bufio.ErrTooLong):
|
||||
return errors.Errorf("dockerfile line greater than max allowed size of %d", bufio.MaxScanTokenSize-1)
|
||||
default:
|
||||
return err
|
||||
|
||||
+28
@@ -177,6 +177,7 @@ func (sw *shellWord) processStopOn(stopChar rune, rawEscapes bool) (string, []st
|
||||
// no need to initialize all the time
|
||||
var charFuncMapping = map[rune]func() (string, error){
|
||||
'$': sw.processDollar,
|
||||
'<': sw.processPossibleHeredoc,
|
||||
}
|
||||
if !sw.SkipProcessQuotes {
|
||||
charFuncMapping['\''] = sw.processSingleQuote
|
||||
@@ -512,6 +513,25 @@ func (sw *shellWord) processName() string {
|
||||
return name.String()
|
||||
}
|
||||
|
||||
func (sw *shellWord) processPossibleHeredoc() (string, error) {
|
||||
sw.scanner.Next()
|
||||
if sw.scanner.Peek() != '<' {
|
||||
return "<", nil // not a heredoc
|
||||
}
|
||||
sw.scanner.Next()
|
||||
|
||||
// heredoc might have whitespace between << and word terminator
|
||||
var space bytes.Buffer
|
||||
nextCh := sw.scanner.Peek()
|
||||
for isWhitespace(nextCh) {
|
||||
space.WriteRune(nextCh)
|
||||
sw.scanner.Next()
|
||||
nextCh = sw.scanner.Peek()
|
||||
}
|
||||
result := "<<" + space.String()
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// isSpecialParam checks if the provided character is a special parameters,
|
||||
// as defined in http://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_05_02
|
||||
func isSpecialParam(char rune) bool {
|
||||
@@ -677,3 +697,11 @@ func trimSuffix(pattern, word string, greedy bool) (string, error) {
|
||||
}
|
||||
return reverseString(str), nil
|
||||
}
|
||||
|
||||
func isWhitespace(r rune) bool {
|
||||
switch r {
|
||||
case '\t', '\r', ' ':
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
+4
-4
@@ -128,8 +128,8 @@ func parseSourceDateEpoch(v string) (*time.Time, error) {
|
||||
func parseLocalSessionIDs(opt map[string]string) map[string]string {
|
||||
m := map[string]string{}
|
||||
for k, v := range opt {
|
||||
if strings.HasPrefix(k, localSessionIDPrefix) {
|
||||
m[strings.TrimPrefix(k, localSessionIDPrefix)] = v
|
||||
if after, ok := strings.CutPrefix(k, localSessionIDPrefix); ok {
|
||||
m[after] = v
|
||||
}
|
||||
}
|
||||
return m
|
||||
@@ -138,8 +138,8 @@ func parseLocalSessionIDs(opt map[string]string) map[string]string {
|
||||
func filter(opt map[string]string, key string) map[string]string {
|
||||
m := map[string]string{}
|
||||
for k, v := range opt {
|
||||
if strings.HasPrefix(k, key) {
|
||||
m[strings.TrimPrefix(k, key)] = v
|
||||
if after, ok := strings.CutPrefix(k, key); ok {
|
||||
m[after] = v
|
||||
}
|
||||
}
|
||||
return m
|
||||
|
||||
+18
-14
@@ -22,7 +22,6 @@ func (bc *Client) Build(ctx context.Context, fn BuildFunc) (*ResultBuilder, erro
|
||||
|
||||
targets := make([]*ocispecs.Platform, 0, len(bc.TargetPlatforms))
|
||||
for _, p := range bc.TargetPlatforms {
|
||||
p := p
|
||||
targets = append(targets, &p)
|
||||
}
|
||||
if len(targets) == 0 {
|
||||
@@ -61,16 +60,12 @@ func (bc *Client) Build(ctx context.Context, fn BuildFunc) (*ResultBuilder, erro
|
||||
} else {
|
||||
p = platforms.DefaultSpec()
|
||||
}
|
||||
|
||||
k := platforms.FormatAll(p)
|
||||
p = extendWindowsPlatform(p, img.Platform)
|
||||
p = platforms.Normalize(p)
|
||||
|
||||
expPlat := makeExportPlatform(p, img.Platform)
|
||||
if bc.MultiPlatformRequested {
|
||||
res.AddRef(k, ref)
|
||||
res.AddMeta(fmt.Sprintf("%s/%s", exptypes.ExporterImageConfigKey, k), config)
|
||||
res.AddRef(expPlat.ID, ref)
|
||||
res.AddMeta(fmt.Sprintf("%s/%s", exptypes.ExporterImageConfigKey, expPlat.ID), config)
|
||||
if len(baseConfig) > 0 {
|
||||
res.AddMeta(fmt.Sprintf("%s/%s", exptypes.ExporterImageBaseConfigKey, k), baseConfig)
|
||||
res.AddMeta(fmt.Sprintf("%s/%s", exptypes.ExporterImageBaseConfigKey, expPlat.ID), baseConfig)
|
||||
}
|
||||
} else {
|
||||
res.SetRef(ref)
|
||||
@@ -79,10 +74,7 @@ func (bc *Client) Build(ctx context.Context, fn BuildFunc) (*ResultBuilder, erro
|
||||
res.AddMeta(exptypes.ExporterImageBaseConfigKey, baseConfig)
|
||||
}
|
||||
}
|
||||
expPlatforms.Platforms[i] = exptypes.Platform{
|
||||
ID: k,
|
||||
Platform: p,
|
||||
}
|
||||
expPlatforms.Platforms[i] = expPlat
|
||||
return nil
|
||||
})
|
||||
}
|
||||
@@ -113,7 +105,6 @@ func (rb *ResultBuilder) Finalize() (*client.Result, error) {
|
||||
func (rb *ResultBuilder) EachPlatform(ctx context.Context, fn func(ctx context.Context, id string, p ocispecs.Platform) error) error {
|
||||
eg, ctx := errgroup.WithContext(ctx)
|
||||
for _, p := range rb.expPlatforms.Platforms {
|
||||
p := p
|
||||
eg.Go(func() error {
|
||||
return fn(ctx, p.ID, p.Platform)
|
||||
})
|
||||
@@ -133,3 +124,16 @@ func extendWindowsPlatform(p, imgP ocispecs.Platform) ocispecs.Platform {
|
||||
}
|
||||
return p
|
||||
}
|
||||
|
||||
func makeExportPlatform(p, imgP ocispecs.Platform) exptypes.Platform {
|
||||
p = platforms.Normalize(p)
|
||||
exp := exptypes.Platform{
|
||||
ID: platforms.FormatAll(p),
|
||||
}
|
||||
if p.OS == "windows" {
|
||||
p = extendWindowsPlatform(p, imgP)
|
||||
p = platforms.Normalize(p)
|
||||
}
|
||||
exp.Platform = p
|
||||
return exp
|
||||
}
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ type GrpcClient interface {
|
||||
|
||||
func New(ctx context.Context, opts map[string]string, session, product string, c pb.LLBBridgeClient, w []client.WorkerInfo) (GrpcClient, error) {
|
||||
pingCtx, pingCancel := context.WithCancelCause(ctx)
|
||||
pingCtx, _ = context.WithTimeoutCause(pingCtx, 15*time.Second, errors.WithStack(context.DeadlineExceeded))
|
||||
pingCtx, _ = context.WithTimeoutCause(pingCtx, 15*time.Second, errors.WithStack(context.DeadlineExceeded)) //nolint:govet
|
||||
defer pingCancel(errors.WithStack(context.Canceled))
|
||||
resp, err := c.Ping(pingCtx, &pb.PingRequest{})
|
||||
if err != nil {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package moby_buildkit_v1_frontend //nolint:revive
|
||||
package moby_buildkit_v1_frontend //nolint:revive,staticcheck
|
||||
|
||||
import "github.com/moby/buildkit/util/apicaps"
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package moby_buildkit_v1_frontend //nolint:revive
|
||||
package moby_buildkit_v1_frontend //nolint:revive,staticcheck
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
+4
-3
@@ -8,6 +8,7 @@ import (
|
||||
"crypto/tls"
|
||||
"crypto/x509"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"os"
|
||||
"runtime"
|
||||
"strconv"
|
||||
@@ -20,7 +21,7 @@ import (
|
||||
"github.com/docker/cli/cli/config"
|
||||
"github.com/docker/cli/cli/config/configfile"
|
||||
"github.com/docker/cli/cli/config/types"
|
||||
http "github.com/hashicorp/go-cleanhttp"
|
||||
cleanhttp "github.com/hashicorp/go-cleanhttp"
|
||||
"github.com/moby/buildkit/session"
|
||||
"github.com/moby/buildkit/session/auth"
|
||||
"github.com/moby/buildkit/util/progress/progresswriter"
|
||||
@@ -125,7 +126,7 @@ func (ap *authProvider) FetchToken(ctx context.Context, req *auth.FetchTokenRequ
|
||||
|
||||
httpClient := tracing.DefaultClient
|
||||
if tc, err := ap.tlsConfig(req.Host); err == nil && tc != nil {
|
||||
transport := http.DefaultTransport()
|
||||
transport := cleanhttp.DefaultTransport()
|
||||
transport.TLSClientConfig = tc
|
||||
httpClient.Transport = tracing.NewTransport(transport)
|
||||
}
|
||||
@@ -151,7 +152,7 @@ func (ap *authProvider) FetchToken(ctx context.Context, req *auth.FetchTokenRequ
|
||||
// Registries without support for POST may return 404 for POST /v2/token.
|
||||
// As of September 2017, GCR is known to return 404.
|
||||
// As of February 2018, JFrog Artifactory is known to return 401.
|
||||
if (errStatus.StatusCode == 405 && to.Username != "") || errStatus.StatusCode == 404 || errStatus.StatusCode == 401 {
|
||||
if (errStatus.StatusCode == http.StatusMethodNotAllowed && to.Username != "") || errStatus.StatusCode == http.StatusNotFound || errStatus.StatusCode == http.StatusUnauthorized {
|
||||
resp, err := authutil.FetchToken(ctx, httpClient, nil, to)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
+5
-5
@@ -32,7 +32,7 @@ type bufferedWriteCloser struct {
|
||||
}
|
||||
|
||||
func (bwc *bufferedWriteCloser) Close() error {
|
||||
if err := bwc.Writer.Flush(); err != nil {
|
||||
if err := bwc.Flush(); err != nil {
|
||||
return errors.WithStack(err)
|
||||
}
|
||||
return bwc.Closer.Close()
|
||||
@@ -59,10 +59,10 @@ func (wc *streamWriterCloser) Write(dt []byte) (int, error) {
|
||||
return n1 + n2, nil
|
||||
}
|
||||
|
||||
if err := wc.ClientStream.SendMsg(&BytesMessage{Data: dt}); err != nil {
|
||||
if err := wc.SendMsg(&BytesMessage{Data: dt}); err != nil {
|
||||
// SendMsg return EOF on remote errors
|
||||
if errors.Is(err, io.EOF) {
|
||||
if err := errors.WithStack(wc.ClientStream.RecvMsg(struct{}{})); err != nil {
|
||||
if err := errors.WithStack(wc.RecvMsg(struct{}{})); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
}
|
||||
@@ -72,12 +72,12 @@ func (wc *streamWriterCloser) Write(dt []byte) (int, error) {
|
||||
}
|
||||
|
||||
func (wc *streamWriterCloser) Close() error {
|
||||
if err := wc.ClientStream.CloseSend(); err != nil {
|
||||
if err := wc.CloseSend(); err != nil {
|
||||
return errors.WithStack(err)
|
||||
}
|
||||
// block until receiver is done
|
||||
var bm BytesMessage
|
||||
if err := wc.ClientStream.RecvMsg(&bm); err != io.EOF {
|
||||
if err := wc.RecvMsg(&bm); !errors.Is(err, io.EOF) {
|
||||
return errors.WithStack(err)
|
||||
}
|
||||
return nil
|
||||
|
||||
+2
-2
@@ -336,8 +336,8 @@ func (sp *SyncTarget) DiffCopy(stream FileSend_DiffCopyServer) (err error) {
|
||||
opts, _ := metadata.FromIncomingContext(stream.Context()) // if no metadata continue with empty object
|
||||
md := map[string]string{}
|
||||
for k, v := range opts {
|
||||
if strings.HasPrefix(k, keyExporterMetaPrefix) {
|
||||
md[strings.TrimPrefix(k, keyExporterMetaPrefix)] = strings.Join(v, ",")
|
||||
if after, ok0 := strings.CutPrefix(k, keyExporterMetaPrefix); ok0 {
|
||||
md[after] = strings.Join(v, ",")
|
||||
}
|
||||
}
|
||||
wc, err := f(md)
|
||||
|
||||
+1
-1
@@ -73,7 +73,7 @@ func (sm *Manager) Any(ctx context.Context, g Group, f func(context.Context, str
|
||||
}
|
||||
|
||||
timeoutCtx, cancel := context.WithCancelCause(ctx)
|
||||
timeoutCtx, _ = context.WithTimeoutCause(timeoutCtx, 5*time.Second, errors.WithStack(context.DeadlineExceeded))
|
||||
timeoutCtx, _ = context.WithTimeoutCause(timeoutCtx, 5*time.Second, errors.WithStack(context.DeadlineExceeded)) //nolint:govet
|
||||
defer func() { cancel(errors.WithStack(context.Canceled)) }()
|
||||
c, err := sm.Get(timeoutCtx, id, false)
|
||||
if err != nil {
|
||||
|
||||
+1
-1
@@ -94,7 +94,7 @@ func monitorHealth(ctx context.Context, cc *grpc.ClientConn, cancelConn func(err
|
||||
timeout := time.Duration(math.Max(float64(defaultHealthcheckDuration), float64(lastHealthcheckDuration)*1.5))
|
||||
|
||||
ctx, cancel := context.WithCancelCause(ctx)
|
||||
ctx, _ = context.WithTimeoutCause(ctx, timeout, errors.WithStack(context.DeadlineExceeded))
|
||||
ctx, _ = context.WithTimeoutCause(ctx, timeout, errors.WithStack(context.DeadlineExceeded)) //nolint:govet
|
||||
_, err := healthClient.Check(ctx, &grpc_health_v1.HealthCheckRequest{})
|
||||
cancel(errors.WithStack(context.Canceled))
|
||||
|
||||
|
||||
+2
-1
@@ -2,6 +2,7 @@ package grpchijack
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"io"
|
||||
"net"
|
||||
"strings"
|
||||
@@ -112,7 +113,7 @@ func (c *conn) Close() (err error) {
|
||||
m.Data = c.buf
|
||||
err = c.stream.RecvMsg(m)
|
||||
if err != nil {
|
||||
if err != io.EOF {
|
||||
if !errors.Is(err, io.EOF) {
|
||||
c.readMu.Unlock()
|
||||
return
|
||||
}
|
||||
|
||||
+2
-2
@@ -21,7 +21,7 @@ func Copy(ctx context.Context, conn io.ReadWriteCloser, stream Stream, closeStre
|
||||
p := &BytesMessage{}
|
||||
for {
|
||||
if err := stream.RecvMsg(p); err != nil {
|
||||
if err == io.EOF {
|
||||
if errors.Is(err, io.EOF) {
|
||||
// indicates client performed CloseSend, but they may still be
|
||||
// reading data
|
||||
if closeWriter, ok := conn.(interface {
|
||||
@@ -55,7 +55,7 @@ func Copy(ctx context.Context, conn io.ReadWriteCloser, stream Stream, closeStre
|
||||
buf := make([]byte, 32*1024)
|
||||
n, err := conn.Read(buf)
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
case errors.Is(err, io.EOF):
|
||||
if closeStream != nil {
|
||||
closeStream()
|
||||
}
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ func (s *server) run(ctx context.Context, l net.Listener, id string) error {
|
||||
|
||||
opts := make(map[string][]string)
|
||||
opts[KeySSHID] = []string{id}
|
||||
ctx = metadata.NewOutgoingContext(ctx, opts)
|
||||
ctx := metadata.NewOutgoingContext(ctx, opts)
|
||||
|
||||
stream, err := client.ForwardAgent(ctx)
|
||||
if err != nil {
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ func (u *Upload) WriteTo(w io.Writer) (int64, error) {
|
||||
for {
|
||||
var bm BytesMessage
|
||||
if err := u.cc.RecvMsg(&bm); err != nil {
|
||||
if err == io.EOF {
|
||||
if errors.Is(err, io.EOF) {
|
||||
return n, nil
|
||||
}
|
||||
return n, errors.WithStack(err)
|
||||
|
||||
+123
-66
@@ -119,6 +119,59 @@ func (x *Source) GetRanges() []*pb.Range {
|
||||
return nil
|
||||
}
|
||||
|
||||
type Frontend struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // frontend name e.g. dockerfile.v0 or gateway.v0
|
||||
Source string `protobuf:"bytes,2,opt,name=source,proto3" json:"source,omitempty"` // used by the gateway frontend to identify the source, which corresponds to the image name
|
||||
}
|
||||
|
||||
func (x *Frontend) Reset() {
|
||||
*x = Frontend{}
|
||||
mi := &file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *Frontend) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Frontend) ProtoMessage() {}
|
||||
|
||||
func (x *Frontend) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_msgTypes[2]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use Frontend.ProtoReflect.Descriptor instead.
|
||||
func (*Frontend) Descriptor() ([]byte, []int) {
|
||||
return file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *Frontend) GetName() string {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Frontend) GetSource() string {
|
||||
if x != nil {
|
||||
return x.Source
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type FrontendCap struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
@@ -129,7 +182,7 @@ type FrontendCap struct {
|
||||
|
||||
func (x *FrontendCap) Reset() {
|
||||
*x = FrontendCap{}
|
||||
mi := &file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_msgTypes[2]
|
||||
mi := &file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -141,7 +194,7 @@ func (x *FrontendCap) String() string {
|
||||
func (*FrontendCap) ProtoMessage() {}
|
||||
|
||||
func (x *FrontendCap) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_msgTypes[2]
|
||||
mi := &file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_msgTypes[3]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -154,7 +207,7 @@ func (x *FrontendCap) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use FrontendCap.ProtoReflect.Descriptor instead.
|
||||
func (*FrontendCap) Descriptor() ([]byte, []int) {
|
||||
return file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_rawDescGZIP(), []int{2}
|
||||
return file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *FrontendCap) GetName() string {
|
||||
@@ -174,7 +227,7 @@ type Subrequest struct {
|
||||
|
||||
func (x *Subrequest) Reset() {
|
||||
*x = Subrequest{}
|
||||
mi := &file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_msgTypes[3]
|
||||
mi := &file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_msgTypes[4]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -186,7 +239,7 @@ func (x *Subrequest) String() string {
|
||||
func (*Subrequest) ProtoMessage() {}
|
||||
|
||||
func (x *Subrequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_msgTypes[3]
|
||||
mi := &file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_msgTypes[4]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -199,7 +252,7 @@ func (x *Subrequest) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use Subrequest.ProtoReflect.Descriptor instead.
|
||||
func (*Subrequest) Descriptor() ([]byte, []int) {
|
||||
return file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_rawDescGZIP(), []int{3}
|
||||
return file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
func (x *Subrequest) GetName() string {
|
||||
@@ -227,7 +280,7 @@ type Solve struct {
|
||||
|
||||
func (x *Solve) Reset() {
|
||||
*x = Solve{}
|
||||
mi := &file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_msgTypes[4]
|
||||
mi := &file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_msgTypes[5]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -239,7 +292,7 @@ func (x *Solve) String() string {
|
||||
func (*Solve) ProtoMessage() {}
|
||||
|
||||
func (x *Solve) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_msgTypes[4]
|
||||
mi := &file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_msgTypes[5]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -252,7 +305,7 @@ func (x *Solve) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use Solve.ProtoReflect.Descriptor instead.
|
||||
func (*Solve) Descriptor() ([]byte, []int) {
|
||||
return file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_rawDescGZIP(), []int{4}
|
||||
return file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_rawDescGZIP(), []int{5}
|
||||
}
|
||||
|
||||
func (x *Solve) GetInputIDs() []string {
|
||||
@@ -331,7 +384,7 @@ type FileAction struct {
|
||||
|
||||
func (x *FileAction) Reset() {
|
||||
*x = FileAction{}
|
||||
mi := &file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_msgTypes[5]
|
||||
mi := &file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_msgTypes[6]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -343,7 +396,7 @@ func (x *FileAction) String() string {
|
||||
func (*FileAction) ProtoMessage() {}
|
||||
|
||||
func (x *FileAction) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_msgTypes[5]
|
||||
mi := &file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_msgTypes[6]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -356,7 +409,7 @@ func (x *FileAction) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use FileAction.ProtoReflect.Descriptor instead.
|
||||
func (*FileAction) Descriptor() ([]byte, []int) {
|
||||
return file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_rawDescGZIP(), []int{5}
|
||||
return file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_rawDescGZIP(), []int{6}
|
||||
}
|
||||
|
||||
func (x *FileAction) GetIndex() int64 {
|
||||
@@ -377,7 +430,7 @@ type ContentCache struct {
|
||||
|
||||
func (x *ContentCache) Reset() {
|
||||
*x = ContentCache{}
|
||||
mi := &file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_msgTypes[6]
|
||||
mi := &file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_msgTypes[7]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -389,7 +442,7 @@ func (x *ContentCache) String() string {
|
||||
func (*ContentCache) ProtoMessage() {}
|
||||
|
||||
func (x *ContentCache) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_msgTypes[6]
|
||||
mi := &file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_msgTypes[7]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -402,7 +455,7 @@ func (x *ContentCache) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use ContentCache.ProtoReflect.Descriptor instead.
|
||||
func (*ContentCache) Descriptor() ([]byte, []int) {
|
||||
return file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_rawDescGZIP(), []int{6}
|
||||
return file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_rawDescGZIP(), []int{7}
|
||||
}
|
||||
|
||||
func (x *ContentCache) GetIndex() int64 {
|
||||
@@ -429,39 +482,42 @@ var file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_rawDesc = []byte{
|
||||
0x75, 0x72, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x12, 0x21,
|
||||
0x0a, 0x06, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x09,
|
||||
0x2e, 0x70, 0x62, 0x2e, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x06, 0x72, 0x61, 0x6e, 0x67, 0x65,
|
||||
0x73, 0x22, 0x21, 0x0a, 0x0b, 0x46, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x43, 0x61, 0x70,
|
||||
0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
|
||||
0x6e, 0x61, 0x6d, 0x65, 0x22, 0x20, 0x0a, 0x0a, 0x53, 0x75, 0x62, 0x72, 0x65, 0x71, 0x75, 0x65,
|
||||
0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0xbf, 0x02, 0x0a, 0x05, 0x53, 0x6f, 0x6c, 0x76, 0x65,
|
||||
0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x49, 0x44, 0x73, 0x18, 0x01, 0x20, 0x03,
|
||||
0x28, 0x09, 0x52, 0x08, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x49, 0x44, 0x73, 0x12, 0x1a, 0x0a, 0x08,
|
||||
0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x44, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08,
|
||||
0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x44, 0x73, 0x12, 0x16, 0x0a, 0x02, 0x6f, 0x70, 0x18, 0x03,
|
||||
0x20, 0x01, 0x28, 0x0b, 0x32, 0x06, 0x2e, 0x70, 0x62, 0x2e, 0x4f, 0x70, 0x52, 0x02, 0x6f, 0x70,
|
||||
0x12, 0x29, 0x0a, 0x04, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13,
|
||||
0x2e, 0x65, 0x72, 0x72, 0x64, 0x65, 0x66, 0x73, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x41, 0x63, 0x74,
|
||||
0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x04, 0x66, 0x69, 0x6c, 0x65, 0x12, 0x2d, 0x0a, 0x05, 0x63,
|
||||
0x61, 0x63, 0x68, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x65, 0x72, 0x72,
|
||||
0x64, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x43, 0x61, 0x63, 0x68,
|
||||
0x65, 0x48, 0x00, 0x52, 0x05, 0x63, 0x61, 0x63, 0x68, 0x65, 0x12, 0x41, 0x0a, 0x0b, 0x64, 0x65,
|
||||
0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32,
|
||||
0x1f, 0x2e, 0x65, 0x72, 0x72, 0x64, 0x65, 0x66, 0x73, 0x2e, 0x53, 0x6f, 0x6c, 0x76, 0x65, 0x2e,
|
||||
0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79,
|
||||
0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x3e, 0x0a,
|
||||
0x10, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x6e, 0x74, 0x72,
|
||||
0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03,
|
||||
0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x09, 0x0a,
|
||||
0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x22, 0x22, 0x0a, 0x0a, 0x46, 0x69, 0x6c, 0x65,
|
||||
0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18,
|
||||
0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x22, 0x24, 0x0a, 0x0c,
|
||||
0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x43, 0x61, 0x63, 0x68, 0x65, 0x12, 0x14, 0x0a, 0x05,
|
||||
0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x69, 0x6e, 0x64,
|
||||
0x65, 0x78, 0x42, 0x29, 0x5a, 0x27, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d,
|
||||
0x2f, 0x6d, 0x6f, 0x62, 0x79, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x6b, 0x69, 0x74, 0x2f, 0x73,
|
||||
0x6f, 0x6c, 0x76, 0x65, 0x72, 0x2f, 0x65, 0x72, 0x72, 0x64, 0x65, 0x66, 0x73, 0x62, 0x06, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x73, 0x22, 0x36, 0x0a, 0x08, 0x46, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x12, 0x12, 0x0a,
|
||||
0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d,
|
||||
0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x22, 0x21, 0x0a, 0x0b, 0x46, 0x72, 0x6f,
|
||||
0x6e, 0x74, 0x65, 0x6e, 0x64, 0x43, 0x61, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x20, 0x0a, 0x0a,
|
||||
0x53, 0x75, 0x62, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61,
|
||||
0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0xbf,
|
||||
0x02, 0x0a, 0x05, 0x53, 0x6f, 0x6c, 0x76, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x70, 0x75,
|
||||
0x74, 0x49, 0x44, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x69, 0x6e, 0x70, 0x75,
|
||||
0x74, 0x49, 0x44, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x44, 0x73,
|
||||
0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x44, 0x73,
|
||||
0x12, 0x16, 0x0a, 0x02, 0x6f, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x06, 0x2e, 0x70,
|
||||
0x62, 0x2e, 0x4f, 0x70, 0x52, 0x02, 0x6f, 0x70, 0x12, 0x29, 0x0a, 0x04, 0x66, 0x69, 0x6c, 0x65,
|
||||
0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x65, 0x72, 0x72, 0x64, 0x65, 0x66, 0x73,
|
||||
0x2e, 0x46, 0x69, 0x6c, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x04, 0x66,
|
||||
0x69, 0x6c, 0x65, 0x12, 0x2d, 0x0a, 0x05, 0x63, 0x61, 0x63, 0x68, 0x65, 0x18, 0x05, 0x20, 0x01,
|
||||
0x28, 0x0b, 0x32, 0x15, 0x2e, 0x65, 0x72, 0x72, 0x64, 0x65, 0x66, 0x73, 0x2e, 0x43, 0x6f, 0x6e,
|
||||
0x74, 0x65, 0x6e, 0x74, 0x43, 0x61, 0x63, 0x68, 0x65, 0x48, 0x00, 0x52, 0x05, 0x63, 0x61, 0x63,
|
||||
0x68, 0x65, 0x12, 0x41, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x65, 0x72, 0x72, 0x64, 0x65, 0x66,
|
||||
0x73, 0x2e, 0x53, 0x6f, 0x6c, 0x76, 0x65, 0x2e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74,
|
||||
0x69, 0x6f, 0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69,
|
||||
0x70, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x3e, 0x0a, 0x10, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70,
|
||||
0x74, 0x69, 0x6f, 0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76,
|
||||
0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75,
|
||||
0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x09, 0x0a, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74,
|
||||
0x22, 0x22, 0x0a, 0x0a, 0x46, 0x69, 0x6c, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x14,
|
||||
0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x69,
|
||||
0x6e, 0x64, 0x65, 0x78, 0x22, 0x24, 0x0a, 0x0c, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x43,
|
||||
0x61, 0x63, 0x68, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x03, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x42, 0x29, 0x5a, 0x27, 0x67, 0x69,
|
||||
0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6d, 0x6f, 0x62, 0x79, 0x2f, 0x62, 0x75,
|
||||
0x69, 0x6c, 0x64, 0x6b, 0x69, 0x74, 0x2f, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x72, 0x2f, 0x65, 0x72,
|
||||
0x72, 0x64, 0x65, 0x66, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -476,27 +532,28 @@ func file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_rawDescGZIP() []
|
||||
return file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
|
||||
var file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_msgTypes = make([]protoimpl.MessageInfo, 9)
|
||||
var file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_goTypes = []any{
|
||||
(*Vertex)(nil), // 0: errdefs.Vertex
|
||||
(*Source)(nil), // 1: errdefs.Source
|
||||
(*FrontendCap)(nil), // 2: errdefs.FrontendCap
|
||||
(*Subrequest)(nil), // 3: errdefs.Subrequest
|
||||
(*Solve)(nil), // 4: errdefs.Solve
|
||||
(*FileAction)(nil), // 5: errdefs.FileAction
|
||||
(*ContentCache)(nil), // 6: errdefs.ContentCache
|
||||
nil, // 7: errdefs.Solve.DescriptionEntry
|
||||
(*pb.SourceInfo)(nil), // 8: pb.SourceInfo
|
||||
(*pb.Range)(nil), // 9: pb.Range
|
||||
(*pb.Op)(nil), // 10: pb.Op
|
||||
(*Frontend)(nil), // 2: errdefs.Frontend
|
||||
(*FrontendCap)(nil), // 3: errdefs.FrontendCap
|
||||
(*Subrequest)(nil), // 4: errdefs.Subrequest
|
||||
(*Solve)(nil), // 5: errdefs.Solve
|
||||
(*FileAction)(nil), // 6: errdefs.FileAction
|
||||
(*ContentCache)(nil), // 7: errdefs.ContentCache
|
||||
nil, // 8: errdefs.Solve.DescriptionEntry
|
||||
(*pb.SourceInfo)(nil), // 9: pb.SourceInfo
|
||||
(*pb.Range)(nil), // 10: pb.Range
|
||||
(*pb.Op)(nil), // 11: pb.Op
|
||||
}
|
||||
var file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_depIdxs = []int32{
|
||||
8, // 0: errdefs.Source.info:type_name -> pb.SourceInfo
|
||||
9, // 1: errdefs.Source.ranges:type_name -> pb.Range
|
||||
10, // 2: errdefs.Solve.op:type_name -> pb.Op
|
||||
5, // 3: errdefs.Solve.file:type_name -> errdefs.FileAction
|
||||
6, // 4: errdefs.Solve.cache:type_name -> errdefs.ContentCache
|
||||
7, // 5: errdefs.Solve.description:type_name -> errdefs.Solve.DescriptionEntry
|
||||
9, // 0: errdefs.Source.info:type_name -> pb.SourceInfo
|
||||
10, // 1: errdefs.Source.ranges:type_name -> pb.Range
|
||||
11, // 2: errdefs.Solve.op:type_name -> pb.Op
|
||||
6, // 3: errdefs.Solve.file:type_name -> errdefs.FileAction
|
||||
7, // 4: errdefs.Solve.cache:type_name -> errdefs.ContentCache
|
||||
8, // 5: errdefs.Solve.description:type_name -> errdefs.Solve.DescriptionEntry
|
||||
6, // [6:6] is the sub-list for method output_type
|
||||
6, // [6:6] is the sub-list for method input_type
|
||||
6, // [6:6] is the sub-list for extension type_name
|
||||
@@ -509,7 +566,7 @@ func file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_init() {
|
||||
if File_github_com_moby_buildkit_solver_errdefs_errdefs_proto != nil {
|
||||
return
|
||||
}
|
||||
file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_msgTypes[4].OneofWrappers = []any{
|
||||
file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_msgTypes[5].OneofWrappers = []any{
|
||||
(*Solve_File)(nil),
|
||||
(*Solve_Cache)(nil),
|
||||
}
|
||||
@@ -519,7 +576,7 @@ func file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_init() {
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_github_com_moby_buildkit_solver_errdefs_errdefs_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 8,
|
||||
NumMessages: 9,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
|
||||
+5
@@ -15,6 +15,11 @@ message Source {
|
||||
repeated pb.Range ranges = 2;
|
||||
}
|
||||
|
||||
message Frontend {
|
||||
string name = 1; // frontend name e.g. dockerfile.v0 or gateway.v0
|
||||
string source = 2; // used by the gateway frontend to identify the source, which corresponds to the image name
|
||||
}
|
||||
|
||||
message FrontendCap {
|
||||
string name = 1;
|
||||
}
|
||||
|
||||
+220
@@ -61,6 +61,24 @@ func (m *Source) CloneMessageVT() proto.Message {
|
||||
return m.CloneVT()
|
||||
}
|
||||
|
||||
func (m *Frontend) CloneVT() *Frontend {
|
||||
if m == nil {
|
||||
return (*Frontend)(nil)
|
||||
}
|
||||
r := new(Frontend)
|
||||
r.Name = m.Name
|
||||
r.Source = m.Source
|
||||
if len(m.unknownFields) > 0 {
|
||||
r.unknownFields = make([]byte, len(m.unknownFields))
|
||||
copy(r.unknownFields, m.unknownFields)
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
func (m *Frontend) CloneMessageVT() proto.Message {
|
||||
return m.CloneVT()
|
||||
}
|
||||
|
||||
func (m *FrontendCap) CloneVT() *FrontendCap {
|
||||
if m == nil {
|
||||
return (*FrontendCap)(nil)
|
||||
@@ -239,6 +257,28 @@ func (this *Source) EqualMessageVT(thatMsg proto.Message) bool {
|
||||
}
|
||||
return this.EqualVT(that)
|
||||
}
|
||||
func (this *Frontend) EqualVT(that *Frontend) bool {
|
||||
if this == that {
|
||||
return true
|
||||
} else if this == nil || that == nil {
|
||||
return false
|
||||
}
|
||||
if this.Name != that.Name {
|
||||
return false
|
||||
}
|
||||
if this.Source != that.Source {
|
||||
return false
|
||||
}
|
||||
return string(this.unknownFields) == string(that.unknownFields)
|
||||
}
|
||||
|
||||
func (this *Frontend) EqualMessageVT(thatMsg proto.Message) bool {
|
||||
that, ok := thatMsg.(*Frontend)
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
return this.EqualVT(that)
|
||||
}
|
||||
func (this *FrontendCap) EqualVT(that *FrontendCap) bool {
|
||||
if this == that {
|
||||
return true
|
||||
@@ -519,6 +559,53 @@ func (m *Source) MarshalToSizedBufferVT(dAtA []byte) (int, error) {
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *Frontend) MarshalVT() (dAtA []byte, err error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
size := m.SizeVT()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalToSizedBufferVT(dAtA[:size])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return dAtA[:n], nil
|
||||
}
|
||||
|
||||
func (m *Frontend) MarshalToVT(dAtA []byte) (int, error) {
|
||||
size := m.SizeVT()
|
||||
return m.MarshalToSizedBufferVT(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *Frontend) MarshalToSizedBufferVT(dAtA []byte) (int, error) {
|
||||
if m == nil {
|
||||
return 0, nil
|
||||
}
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if m.unknownFields != nil {
|
||||
i -= len(m.unknownFields)
|
||||
copy(dAtA[i:], m.unknownFields)
|
||||
}
|
||||
if len(m.Source) > 0 {
|
||||
i -= len(m.Source)
|
||||
copy(dAtA[i:], m.Source)
|
||||
i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Source)))
|
||||
i--
|
||||
dAtA[i] = 0x12
|
||||
}
|
||||
if len(m.Name) > 0 {
|
||||
i -= len(m.Name)
|
||||
copy(dAtA[i:], m.Name)
|
||||
i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Name)))
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *FrontendCap) MarshalVT() (dAtA []byte, err error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
@@ -844,6 +931,24 @@ func (m *Source) SizeVT() (n int) {
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *Frontend) SizeVT() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
l = len(m.Name)
|
||||
if l > 0 {
|
||||
n += 1 + l + protohelpers.SizeOfVarint(uint64(l))
|
||||
}
|
||||
l = len(m.Source)
|
||||
if l > 0 {
|
||||
n += 1 + l + protohelpers.SizeOfVarint(uint64(l))
|
||||
}
|
||||
n += len(m.unknownFields)
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *FrontendCap) SizeVT() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
@@ -1167,6 +1272,121 @@ func (m *Source) UnmarshalVT(dAtA []byte) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *Frontend) UnmarshalVT(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
preIndex := iNdEx
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return protohelpers.ErrIntOverflow
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return fmt.Errorf("proto: Frontend: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: Frontend: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Name", 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.Name = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 2:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Source", 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.Source = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := protohelpers.Skip(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||
return protohelpers.ErrInvalidLength
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...)
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *FrontendCap) UnmarshalVT(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
package errdefs
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/containerd/typeurl/v2"
|
||||
"github.com/moby/buildkit/util/grpcerrors"
|
||||
)
|
||||
|
||||
func init() {
|
||||
typeurl.Register((*Frontend)(nil), "github.com/moby/buildkit", "errdefs.Frontend+json")
|
||||
}
|
||||
|
||||
type FrontendError struct {
|
||||
*Frontend
|
||||
error
|
||||
}
|
||||
|
||||
func (e *FrontendError) Error() string {
|
||||
// These can be nested, so avoid adding any details to the error message
|
||||
// if we already have an error. Otherwise the resulting error message
|
||||
// can be very long and not very useful.
|
||||
if e.error != nil {
|
||||
return e.error.Error()
|
||||
}
|
||||
return fmt.Sprintf("frontend %s failed", e.Name)
|
||||
}
|
||||
|
||||
func (e *FrontendError) Unwrap() error {
|
||||
return e.error
|
||||
}
|
||||
|
||||
func (e *FrontendError) ToProto() grpcerrors.TypedErrorProto {
|
||||
return e.Frontend
|
||||
}
|
||||
|
||||
func (v *Frontend) WrapError(err error) error {
|
||||
return &FrontendError{error: err, Frontend: v}
|
||||
}
|
||||
|
||||
func Frontends(err error) []*Frontend {
|
||||
var out []*Frontend
|
||||
var es *FrontendError
|
||||
if errors.As(err, &es) {
|
||||
out = Frontends(es.Unwrap())
|
||||
out = append(out, es.CloneVT())
|
||||
}
|
||||
return out
|
||||
}
|
||||
Generated
Vendored
+1
-1
@@ -17,7 +17,7 @@ type UnsupportedFrontendCapError struct {
|
||||
}
|
||||
|
||||
func (e *UnsupportedFrontendCapError) Error() string {
|
||||
msg := fmt.Sprintf("unsupported frontend capability %s", e.FrontendCap.Name)
|
||||
msg := fmt.Sprintf("unsupported frontend capability %s", e.Name)
|
||||
if e.error != nil {
|
||||
msg += ": " + e.error.Error()
|
||||
}
|
||||
+1
-1
@@ -14,7 +14,7 @@ func init() {
|
||||
typeurl.Register((*Solve)(nil), "github.com/moby/buildkit", "errdefs.Solve+json")
|
||||
}
|
||||
|
||||
//nolint:revive
|
||||
//nolint:revive,staticcheck
|
||||
type IsSolve_Subject isSolve_Subject
|
||||
|
||||
// SolveError will be returned when an error is encountered during a solve that
|
||||
|
||||
+8
-11
@@ -14,34 +14,34 @@ func WithSource(err error, src *Source) error {
|
||||
if err == nil {
|
||||
return nil
|
||||
}
|
||||
return &ErrorSource{Source: src, error: err}
|
||||
return &SourceError{Source: src, error: err}
|
||||
}
|
||||
|
||||
type ErrorSource struct {
|
||||
type SourceError struct {
|
||||
*Source
|
||||
error
|
||||
}
|
||||
|
||||
func (e *ErrorSource) Unwrap() error {
|
||||
func (e *SourceError) Unwrap() error {
|
||||
return e.error
|
||||
}
|
||||
|
||||
func (e *ErrorSource) ToProto() grpcerrors.TypedErrorProto {
|
||||
func (e *SourceError) ToProto() grpcerrors.TypedErrorProto {
|
||||
return e.Source
|
||||
}
|
||||
|
||||
func Sources(err error) []*Source {
|
||||
var out []*Source
|
||||
var es *ErrorSource
|
||||
var es *SourceError
|
||||
if errors.As(err, &es) {
|
||||
out = Sources(es.Unwrap())
|
||||
out = append(out, es.Source.CloneVT())
|
||||
out = append(out, es.CloneVT())
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
func (s *Source) WrapError(err error) error {
|
||||
return &ErrorSource{error: err, Source: s}
|
||||
return &SourceError{error: err, Source: s}
|
||||
}
|
||||
|
||||
func (s *Source) Print(w io.Writer) error {
|
||||
@@ -69,10 +69,7 @@ func (s *Source) Print(w io.Writer) error {
|
||||
var p int
|
||||
|
||||
prepadStart := start
|
||||
for {
|
||||
if p >= pad {
|
||||
break
|
||||
}
|
||||
for p < pad {
|
||||
if start > 1 {
|
||||
start--
|
||||
p++
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ type UnsupportedSubrequestError struct {
|
||||
}
|
||||
|
||||
func (e *UnsupportedSubrequestError) Error() string {
|
||||
msg := fmt.Sprintf("unsupported request %s", e.Subrequest.Name)
|
||||
msg := fmt.Sprintf("unsupported request %s", e.Name)
|
||||
if e.error != nil {
|
||||
msg += ": " + e.error.Error()
|
||||
}
|
||||
|
||||
+3
-1
@@ -1,6 +1,8 @@
|
||||
package result
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
pb "github.com/moby/buildkit/frontend/gateway/pb"
|
||||
digest "github.com/opencontainers/go-digest"
|
||||
)
|
||||
@@ -23,7 +25,7 @@ type Attestation[T any] struct {
|
||||
|
||||
Ref T
|
||||
Path string
|
||||
ContentFunc func() ([]byte, error)
|
||||
ContentFunc func(context.Context) ([]byte, error)
|
||||
|
||||
InToto InTotoAttestation
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package moby_buildkit_v1_sourcepolicy //nolint:revive
|
||||
package moby_buildkit_v1_sourcepolicy //nolint:revive,staticcheck
|
||||
|
||||
import (
|
||||
"github.com/moby/buildkit/util/gogo/proto"
|
||||
|
||||
+4
-3
@@ -1,8 +1,9 @@
|
||||
package apicaps
|
||||
|
||||
import (
|
||||
"cmp"
|
||||
"fmt"
|
||||
"sort"
|
||||
"slices"
|
||||
"strings"
|
||||
|
||||
pb "github.com/moby/buildkit/util/apicaps/pb"
|
||||
@@ -76,8 +77,8 @@ func (l *CapList) All() []*pb.APICap {
|
||||
DisabledAlternative: c.DisabledAlternative,
|
||||
})
|
||||
}
|
||||
sort.Slice(out, func(i, j int) bool {
|
||||
return out[i].ID < out[j].ID
|
||||
slices.SortFunc(out, func(a, b *pb.APICap) int {
|
||||
return cmp.Compare(a.ID, b.ID)
|
||||
})
|
||||
return out
|
||||
}
|
||||
|
||||
+2
-2
@@ -25,11 +25,11 @@ func Context() context.Context {
|
||||
|
||||
ctx := context.Background()
|
||||
for _, f := range inits {
|
||||
ctx = f(ctx)
|
||||
ctx = f(ctx) //nolint:fatcontext
|
||||
}
|
||||
|
||||
ctx, cancel := context.WithCancelCause(ctx)
|
||||
appContextCache = ctx
|
||||
appContextCache = ctx //nolint:fatcontext
|
||||
|
||||
go func() {
|
||||
for {
|
||||
|
||||
+3
-2
@@ -12,8 +12,9 @@ const (
|
||||
var (
|
||||
Root = filepath.Join(os.Getenv("ProgramData"), "buildkitd", ".buildstate")
|
||||
ConfigDir = filepath.Join(os.Getenv("ProgramData"), "buildkitd")
|
||||
DefaultCNIBinDir = filepath.Join(ConfigDir, "bin")
|
||||
DefaultCNIConfigPath = filepath.Join(ConfigDir, "cni.json")
|
||||
defaultContainerdDir = filepath.Join(os.Getenv("ProgramFiles"), "containerd")
|
||||
DefaultCNIBinDir = filepath.Join(defaultContainerdDir, "cni", "bin")
|
||||
DefaultCNIConfigPath = filepath.Join(defaultContainerdDir, "cni", "conf", "0-containerd-nat.conf")
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
+2
-2
@@ -27,7 +27,7 @@ type localFetcher struct {
|
||||
}
|
||||
|
||||
func (f *localFetcher) Fetch(ctx context.Context, desc ocispecs.Descriptor) (io.ReadCloser, error) {
|
||||
r, err := f.Provider.ReaderAt(ctx, desc)
|
||||
r, err := f.ReaderAt(ctx, desc)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -42,7 +42,7 @@ type rc struct {
|
||||
func (r *rc) Read(b []byte) (int, error) {
|
||||
n, err := r.ReadAt(b, r.offset)
|
||||
r.offset += int64(n)
|
||||
if n > 0 && err == io.EOF {
|
||||
if n > 0 && errors.Is(err, io.EOF) {
|
||||
err = nil
|
||||
}
|
||||
return n, err
|
||||
|
||||
+2
-2
@@ -54,8 +54,8 @@ func (r *readerAt) ReadAt(b []byte, off int64) (int, error) {
|
||||
|
||||
var totalN int
|
||||
for len(b) > 0 {
|
||||
n, err := r.Reader.Read(b)
|
||||
if err == io.EOF && n == len(b) {
|
||||
n, err := r.Read(b)
|
||||
if errors.Is(err, io.EOF) && n == len(b) {
|
||||
err = nil
|
||||
}
|
||||
r.offset += int64(n)
|
||||
|
||||
+1
-1
@@ -17,6 +17,6 @@ func GetDiskStat(root string) (DiskStat, error) {
|
||||
return DiskStat{
|
||||
Total: int64(st.Bsize) * int64(st.Blocks),
|
||||
Free: int64(st.Bsize) * int64(st.Bfree),
|
||||
Available: int64(st.Bsize) * int64(st.Bavail),
|
||||
Available: int64(st.Bsize) * st.Bavail,
|
||||
}, nil
|
||||
}
|
||||
|
||||
+3
-4
@@ -5,7 +5,6 @@ import (
|
||||
"io"
|
||||
"math/rand"
|
||||
"slices"
|
||||
"sort"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
@@ -300,7 +299,7 @@ func (ps *progressState) run(pr progress.Reader) {
|
||||
for {
|
||||
p, err := pr.Read(context.TODO())
|
||||
if err != nil {
|
||||
if err == io.EOF {
|
||||
if errors.Is(err, io.EOF) {
|
||||
ps.mu.Lock()
|
||||
ps.done = true
|
||||
ps.mu.Unlock()
|
||||
@@ -331,8 +330,8 @@ func (ps *progressState) add(pw progress.Writer) {
|
||||
for _, p := range ps.items {
|
||||
plist = append(plist, p)
|
||||
}
|
||||
sort.Slice(plist, func(i, j int) bool {
|
||||
return plist[i].Timestamp.Before(plist[j].Timestamp)
|
||||
slices.SortFunc(plist, func(a, b *progress.Progress) int {
|
||||
return a.Timestamp.Compare(b.Timestamp)
|
||||
})
|
||||
for _, p := range plist {
|
||||
rw.WriteRawProgress(p)
|
||||
|
||||
+23
-5
@@ -45,7 +45,7 @@ func ToGRPC(ctx context.Context, err error) error {
|
||||
|
||||
// If the original error was wrapped with more context than the GRPCStatus error,
|
||||
// copy the original message to the GRPCStatus error
|
||||
if err.Error() != st.Message() {
|
||||
if errorHasMoreContext(err, st) {
|
||||
pb := st.Proto()
|
||||
pb.Message = err.Error()
|
||||
st = status.FromProto(pb)
|
||||
@@ -72,6 +72,21 @@ func ToGRPC(ctx context.Context, err error) error {
|
||||
return st.Err()
|
||||
}
|
||||
|
||||
// errorHasMoreContext checks if the original error provides more context by having
|
||||
// a different message or additional details than the Status.
|
||||
func errorHasMoreContext(err error, st *status.Status) bool {
|
||||
if errMessage := err.Error(); len(errMessage) > len(st.Message()) {
|
||||
// check if the longer message in errMessage is only due to
|
||||
// prepending with the status code
|
||||
var grpcStatusError *grpcStatusError
|
||||
if errors.As(err, &grpcStatusError) {
|
||||
return st.Code() != grpcStatusError.st.Code() || st.Message() != grpcStatusError.st.Message()
|
||||
}
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func withDetails(ctx context.Context, s *status.Status, details ...proto.Message) (*status.Status, error) {
|
||||
if s.Code() == codes.OK {
|
||||
return nil, errors.New("no error details for status with code OK")
|
||||
@@ -124,7 +139,7 @@ func Code(err error) codes.Code {
|
||||
}
|
||||
|
||||
func WrapCode(err error, code codes.Code) error {
|
||||
return &withCode{error: err, code: code}
|
||||
return &withCodeError{error: err, code: code}
|
||||
}
|
||||
|
||||
func AsGRPCStatus(err error) (*status.Status, bool) {
|
||||
@@ -172,6 +187,8 @@ func FromGRPC(err error) error {
|
||||
for _, d := range pb.Details {
|
||||
m, err := typeurl.UnmarshalAny(d)
|
||||
if err != nil {
|
||||
bklog.L.Debugf("failed to unmarshal error detail with type %q: %v", d.GetTypeUrl(), err)
|
||||
n.Details = append(n.Details, d)
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -181,6 +198,7 @@ func FromGRPC(err error) error {
|
||||
case TypedErrorProto:
|
||||
details = append(details, v)
|
||||
default:
|
||||
bklog.L.Debugf("unknown detail with type %T", v)
|
||||
n.Details = append(n.Details, d)
|
||||
}
|
||||
}
|
||||
@@ -219,16 +237,16 @@ func (e *grpcStatusError) GRPCStatus() *status.Status {
|
||||
return e.st
|
||||
}
|
||||
|
||||
type withCode struct {
|
||||
type withCodeError struct {
|
||||
code codes.Code
|
||||
error
|
||||
}
|
||||
|
||||
func (e *withCode) Code() codes.Code {
|
||||
func (e *withCodeError) Code() codes.Code {
|
||||
return e.code
|
||||
}
|
||||
|
||||
func (e *withCode) Unwrap() error {
|
||||
func (e *withCodeError) Unwrap() error {
|
||||
return e.error
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -2,6 +2,7 @@ package progress
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"io"
|
||||
"sync"
|
||||
)
|
||||
@@ -110,7 +111,7 @@ func (mr *MultiReader) handle() error {
|
||||
for {
|
||||
p, err := mr.main.Read(context.TODO())
|
||||
if err != nil {
|
||||
if err == io.EOF {
|
||||
if errors.Is(err, io.EOF) {
|
||||
mr.mu.Lock()
|
||||
cancelErr := context.Canceled
|
||||
for w, c := range mr.writers {
|
||||
|
||||
+3
-3
@@ -2,7 +2,7 @@ package progress
|
||||
|
||||
import (
|
||||
"maps"
|
||||
"sort"
|
||||
"slices"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
@@ -49,8 +49,8 @@ func (ps *MultiWriter) Add(pw Writer) {
|
||||
ps.mu.Lock()
|
||||
plist := make([]*Progress, 0, len(ps.items))
|
||||
plist = append(plist, ps.items...)
|
||||
sort.Slice(plist, func(i, j int) bool {
|
||||
return plist[i].Timestamp.Before(plist[j].Timestamp)
|
||||
slices.SortFunc(plist, func(a, b *Progress) int {
|
||||
return a.Timestamp.Compare(b.Timestamp)
|
||||
})
|
||||
for _, p := range plist {
|
||||
rw.WriteRawProgress(p)
|
||||
|
||||
+3
-4
@@ -4,7 +4,7 @@ import (
|
||||
"context"
|
||||
"io"
|
||||
"maps"
|
||||
"sort"
|
||||
"slices"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
@@ -165,9 +165,8 @@ func (pr *progressReader) Read(ctx context.Context) ([]*Progress, error) {
|
||||
for _, p := range dmap {
|
||||
out = append(out, p)
|
||||
}
|
||||
|
||||
sort.Slice(out, func(i, j int) bool {
|
||||
return out[i].Timestamp.Before(out[j].Timestamp)
|
||||
slices.SortFunc(out, func(a, b *Progress) int {
|
||||
return a.Timestamp.Compare(b.Timestamp)
|
||||
})
|
||||
|
||||
return out, nil
|
||||
|
||||
+4
-4
@@ -40,7 +40,7 @@ func setUserDefinedTermColors(colorsEnv string) {
|
||||
for _, field := range fields {
|
||||
k, v, ok := strings.Cut(field, "=")
|
||||
if !ok || strings.Contains(v, "=") {
|
||||
err := errors.New("A valid entry must have exactly two fields")
|
||||
err := errors.New("valid entry must have exactly two fields")
|
||||
bklog.L.WithError(err).Warnf("Could not parse BUILDKIT_COLORS component: %s", field)
|
||||
continue
|
||||
}
|
||||
@@ -52,7 +52,7 @@ func setUserDefinedTermColors(colorsEnv string) {
|
||||
parseKeys(k, c)
|
||||
}
|
||||
} else {
|
||||
err := errors.New("Colors must be a name from the pre-defined list or a valid 3-part RGB value")
|
||||
err := errors.New("colors must be a name from the pre-defined list or a valid 3-part RGB value")
|
||||
bklog.L.WithError(err).Warnf("Unknown color value found in BUILDKIT_COLORS: %s=%s", k, v)
|
||||
}
|
||||
}
|
||||
@@ -63,7 +63,7 @@ func readBuildkitColorsEnv(colorsEnv string) []string {
|
||||
csvReader.Comma = ':'
|
||||
fields, err := csvReader.Fields(colorsEnv, nil)
|
||||
if err != nil {
|
||||
bklog.L.WithError(err).Warnf("Could not parse BUILDKIT_COLORS. Falling back to defaults.")
|
||||
bklog.L.WithError(err).Warnf("could not parse BUILDKIT_COLORS. Falling back to defaults.")
|
||||
return nil
|
||||
}
|
||||
return fields
|
||||
@@ -76,7 +76,7 @@ func readRGB(v string) aec.ANSI {
|
||||
return nil
|
||||
}
|
||||
if len(fields) != 3 {
|
||||
err = errors.New("A valid RGB color must have three fields")
|
||||
err = errors.New("valid RGB color must have three fields")
|
||||
bklog.L.WithError(err).Warnf("Could not parse value %s as valid RGB color. Ignoring.", v)
|
||||
return nil
|
||||
}
|
||||
|
||||
+19
-9
@@ -8,6 +8,7 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"slices"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
@@ -518,8 +519,8 @@ func mergeIntervals(intervals []interval) []interval {
|
||||
}
|
||||
|
||||
// sort intervals by start time
|
||||
sort.Slice(intervals, func(i, j int) bool {
|
||||
return intervals[i].start.Before(*intervals[j].start)
|
||||
slices.SortFunc(intervals, func(a, b interval) int {
|
||||
return a.start.Compare(*b.start)
|
||||
})
|
||||
|
||||
var merged []interval
|
||||
@@ -587,10 +588,8 @@ func (t *trace) triggerVertexEvent(v *client.Vertex) {
|
||||
old = *v
|
||||
}
|
||||
|
||||
changed := false
|
||||
if v.Digest != old.Digest {
|
||||
changed = true
|
||||
}
|
||||
changed := v.Digest != old.Digest
|
||||
|
||||
if v.Name != old.Name {
|
||||
changed = true
|
||||
}
|
||||
@@ -641,7 +640,11 @@ func (t *trace) update(s *client.SolveStatus, termWidth int) {
|
||||
subVtxs: make(map[digest.Digest]client.Vertex),
|
||||
}
|
||||
if t.modeConsole {
|
||||
group.term = vt100.NewVT100(termHeight, termWidth-termPad)
|
||||
w := termWidth - termPad
|
||||
if w <= 0 {
|
||||
w = 1
|
||||
}
|
||||
group.term = vt100.NewVT100(termHeight, w)
|
||||
}
|
||||
t.groups[v.ProgressGroup.Id] = group
|
||||
t.byDigest[group.Digest] = group.vertex
|
||||
@@ -662,7 +665,11 @@ func (t *trace) update(s *client.SolveStatus, termWidth int) {
|
||||
intervals: make(map[int64]interval),
|
||||
}
|
||||
if t.modeConsole {
|
||||
t.byDigest[v.Digest].term = vt100.NewVT100(termHeight, termWidth-termPad)
|
||||
w := termWidth - termPad
|
||||
if w <= 0 {
|
||||
w = 1
|
||||
}
|
||||
t.byDigest[v.Digest].term = vt100.NewVT100(termHeight, w)
|
||||
}
|
||||
}
|
||||
t.triggerVertexEvent(v)
|
||||
@@ -673,7 +680,7 @@ func (t *trace) update(s *client.SolveStatus, termWidth int) {
|
||||
t.vertexes = append(t.vertexes, t.byDigest[v.Digest])
|
||||
}
|
||||
// allow a duplicate initial vertex that shouldn't reset state
|
||||
if !(prev != nil && prev.isStarted() && v.Started == nil) {
|
||||
if prev == nil || !prev.isStarted() || v.Started != nil {
|
||||
t.byDigest[v.Digest].Vertex = v
|
||||
}
|
||||
if v.Started != nil {
|
||||
@@ -1000,6 +1007,9 @@ func (disp *ttyDisplay) print(d displayInfo, width, height int, all bool) {
|
||||
} else {
|
||||
out = align(out, "", width)
|
||||
}
|
||||
if len(out) > width {
|
||||
out = out[:width]
|
||||
}
|
||||
fmt.Fprintln(disp.c, out)
|
||||
lineCount := 0
|
||||
for _, j := range d.jobs {
|
||||
|
||||
+1
-1
@@ -147,7 +147,7 @@ func (p *textMux) printVtx(t *trace, dgst digest.Digest) {
|
||||
l = l[v.logsOffset:]
|
||||
fmt.Fprintf(p.w, "%s", l)
|
||||
} else {
|
||||
fmt.Fprintf(p.w, "#%d %s", v.index, []byte(l))
|
||||
fmt.Fprintf(p.w, "#%d %s", v.index, l)
|
||||
}
|
||||
|
||||
if i != len(v.logs)-1 || !v.logsPartial {
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ loop0:
|
||||
}
|
||||
// full match, potentially skip all
|
||||
if idx == len(st.Frames)-1 {
|
||||
if st.Pid == prev.Pid && st.Version == prev.Version && slices.Compare(st.Cmdline, st.Cmdline) == 0 {
|
||||
if st.Pid == prev.Pid && st.Version == prev.Version && slices.Equal(st.Cmdline, prev.Cmdline) {
|
||||
continue loop0
|
||||
}
|
||||
}
|
||||
|
||||
+6
-6
@@ -50,7 +50,7 @@ func Traces(err error) []*Stack {
|
||||
func traces(err error) []*Stack {
|
||||
var st []*Stack
|
||||
|
||||
switch e := err.(type) {
|
||||
switch e := err.(type) { //nolint:errorlint
|
||||
case interface{ Unwrap() error }:
|
||||
st = Traces(e.Unwrap())
|
||||
case interface{ Unwrap() []error }:
|
||||
@@ -63,7 +63,7 @@ func traces(err error) []*Stack {
|
||||
}
|
||||
}
|
||||
|
||||
switch ste := err.(type) {
|
||||
switch ste := err.(type) { //nolint:errorlint
|
||||
case interface{ StackTrace() errors.StackTrace }:
|
||||
st = append(st, convertStack(ste.StackTrace()))
|
||||
case interface{ StackTrace() *Stack }:
|
||||
@@ -85,7 +85,7 @@ func Enable(err error) error {
|
||||
}
|
||||
|
||||
func Wrap(err error, s *Stack) error {
|
||||
return &withStack{stack: s, error: err}
|
||||
return &withStackError{stack: s, error: err}
|
||||
}
|
||||
|
||||
func hasLocalStackTrace(err error) bool {
|
||||
@@ -173,15 +173,15 @@ func convertStack(s errors.StackTrace) *Stack {
|
||||
return &out
|
||||
}
|
||||
|
||||
type withStack struct {
|
||||
type withStackError struct {
|
||||
stack *Stack
|
||||
error
|
||||
}
|
||||
|
||||
func (e *withStack) Unwrap() error {
|
||||
func (e *withStackError) Unwrap() error {
|
||||
return e.error
|
||||
}
|
||||
|
||||
func (e *withStack) StackTrace() *Stack {
|
||||
func (e *withStackError) StackTrace() *Stack {
|
||||
return e.stack
|
||||
}
|
||||
|
||||
+6
-3
@@ -52,15 +52,18 @@ func (cli *Client) doRequest(req *http.Request) (*http.Response, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if uErr, ok := err.(*url.Error); ok {
|
||||
if nErr, ok := uErr.Err.(*net.OpError); ok {
|
||||
uErr := &url.Error{}
|
||||
if errors.As(err, &uErr) {
|
||||
nErr := &net.OpError{}
|
||||
if errors.As(uErr.Err, &nErr) {
|
||||
if os.IsPermission(nErr.Err) {
|
||||
return nil, errors.Wrapf(err, "permission denied while trying to connect to the Docker daemon socket at %v", cli.host)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if nErr, ok := err.(net.Error); ok {
|
||||
var nErr net.Error
|
||||
if errors.As(err, &nErr) {
|
||||
// FIXME(thaJeztah): any net.Error should be considered a connection error (but we should include the original error)?
|
||||
if nErr.Timeout() {
|
||||
return nil, ErrorConnectionFailed(cli.host)
|
||||
|
||||
+2
-2
@@ -72,7 +72,7 @@ func NewDaemon(workingDir string, ops ...Option) (*Daemon, error) {
|
||||
execRoot: filepath.Join(os.TempDir(), "dxr", id),
|
||||
dockerdBinary: DefaultDockerdBinary,
|
||||
Log: nopLog{},
|
||||
sockPath: filepath.Join(sockRoot, id+".sock"),
|
||||
sockPath: getDockerdSockPath(sockRoot, id),
|
||||
envs: os.Environ(),
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ func WithExtraEnv(envs []string) Option {
|
||||
}
|
||||
|
||||
func (d *Daemon) Sock() string {
|
||||
return "unix://" + d.sockPath
|
||||
return socketScheme + d.sockPath
|
||||
}
|
||||
|
||||
func (d *Daemon) StartWithError(daemonLogs map[string]*bytes.Buffer, providedArgs ...string) error {
|
||||
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
//go:build !windows
|
||||
|
||||
package dockerd
|
||||
|
||||
import "path/filepath"
|
||||
|
||||
const socketScheme = "unix://"
|
||||
|
||||
func getDockerdSockPath(sockRoot, id string) string {
|
||||
return filepath.Join(sockRoot, id+".sock")
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
package dockerd
|
||||
|
||||
const socketScheme = "npipe://"
|
||||
|
||||
func getDockerdSockPath(_, id string) string {
|
||||
return `//./pipe/dockerd-` + id
|
||||
}
|
||||
+1
-1
@@ -68,7 +68,7 @@ http:
|
||||
deferF.Append(stop)
|
||||
|
||||
ctx, cancel := context.WithCancelCause(context.Background())
|
||||
ctx, _ = context.WithTimeoutCause(ctx, 5*time.Second, errors.WithStack(context.DeadlineExceeded))
|
||||
ctx, _ = context.WithTimeoutCause(ctx, 5*time.Second, errors.WithStack(context.DeadlineExceeded)) //nolint:govet
|
||||
defer func() { cancel(errors.WithStack(context.Canceled)) }()
|
||||
url, err = detectPort(ctx, rc)
|
||||
if err != nil {
|
||||
|
||||
+8
-8
@@ -12,7 +12,7 @@ import (
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"runtime"
|
||||
"sort"
|
||||
"slices"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
@@ -168,8 +168,8 @@ func Run(t *testing.T, testCases []Test, opt ...TestOpt) {
|
||||
parts := strings.Split(filter, "/")
|
||||
if len(parts) >= 2 {
|
||||
const prefix = "slice="
|
||||
if strings.HasPrefix(parts[1], prefix) {
|
||||
conf := strings.TrimPrefix(parts[1], prefix)
|
||||
if after, ok0 := strings.CutPrefix(parts[1], prefix); ok0 {
|
||||
conf := after
|
||||
offsetS, totalS, ok := strings.Cut(conf, "-")
|
||||
if !ok {
|
||||
t.Fatalf("invalid slice=%q", conf)
|
||||
@@ -462,7 +462,7 @@ func (mv matrixValue) functionSuffix() string {
|
||||
if len(mv.fn) == 0 {
|
||||
return ""
|
||||
}
|
||||
sort.Strings(mv.fn)
|
||||
slices.Sort(mv.fn)
|
||||
sb := &strings.Builder{}
|
||||
for _, f := range mv.fn {
|
||||
sb.Write([]byte("/" + f + "=" + mv.values[f].name))
|
||||
@@ -514,8 +514,8 @@ func prepareValueMatrix(tc testConf) []matrixValue {
|
||||
func SkipOnPlatform(t *testing.T, goos string) {
|
||||
skip := false
|
||||
// support for negation
|
||||
if strings.HasPrefix(goos, "!") {
|
||||
goos = strings.TrimPrefix(goos, "!")
|
||||
if after, ok := strings.CutPrefix(goos, "!"); ok {
|
||||
goos = after
|
||||
skip = runtime.GOOS != goos
|
||||
} else {
|
||||
skip = runtime.GOOS == goos
|
||||
@@ -539,8 +539,8 @@ func UnixOrWindows[T any](unix, windows T) T {
|
||||
func lookupTestFilter() (string, bool) {
|
||||
const prefix = "-test.run="
|
||||
for _, arg := range os.Args {
|
||||
if strings.HasPrefix(arg, prefix) {
|
||||
return strings.TrimPrefix(arg, prefix), true
|
||||
if after, ok := strings.CutPrefix(arg, prefix); ok {
|
||||
return after, true
|
||||
}
|
||||
}
|
||||
return "", false
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ func ReadTarToMap(dt []byte, compressed bool) (map[string]*TarItem, error) {
|
||||
for {
|
||||
h, err := tr.Next()
|
||||
if err != nil {
|
||||
if err == io.EOF {
|
||||
if errors.Is(err, io.EOF) {
|
||||
return m, nil
|
||||
}
|
||||
return nil, errors.Wrap(err, "error reading tar")
|
||||
|
||||
+7
-3
@@ -111,6 +111,7 @@ func (c Moby) New(ctx context.Context, cfg *integration.BackendConfig) (b integr
|
||||
"containerd-snapshotter": c.ContainerdSnapshotter,
|
||||
},
|
||||
}
|
||||
|
||||
if reg, ok := bkcfg.Registries["docker.io"]; ok && len(reg.Mirrors) > 0 {
|
||||
for _, m := range reg.Mirrors {
|
||||
dcfg.Mirrors = append(dcfg.Mirrors, "http://"+m)
|
||||
@@ -158,10 +159,13 @@ func (c Moby) New(ctx context.Context, cfg *integration.BackendConfig) (b integr
|
||||
|
||||
dockerdFlags := []string{
|
||||
"--config-file", dockerdConfigFile,
|
||||
"--userland-proxy=false",
|
||||
"--tls=false",
|
||||
"--debug",
|
||||
}
|
||||
|
||||
// add platform-specific flags
|
||||
dockerdFlags = applyDockerdPlatformFlags(dockerdFlags, c.ID)
|
||||
|
||||
if s := os.Getenv("BUILDKIT_INTEGRATION_DOCKERD_FLAGS"); s != "" {
|
||||
dockerdFlags = append(dockerdFlags, strings.Split(strings.TrimSpace(s), "\n")...)
|
||||
}
|
||||
@@ -198,7 +202,7 @@ func (c Moby) New(ctx context.Context, cfg *integration.BackendConfig) (b integr
|
||||
f.Close()
|
||||
os.Remove(localPath)
|
||||
|
||||
listener, err := net.Listen("unix", localPath)
|
||||
listener, err := net.Listen(buildkitdNetworkProtocol, getBuildkitdNetworkAddr(localPath))
|
||||
if err != nil {
|
||||
return nil, nil, errors.Wrapf(err, "dockerd listener error: %s", integration.FormatLogs(cfg.Logs))
|
||||
}
|
||||
@@ -234,7 +238,7 @@ func (c Moby) New(ctx context.Context, cfg *integration.BackendConfig) (b integr
|
||||
})
|
||||
|
||||
return backend{
|
||||
address: "unix://" + listener.Addr().String(),
|
||||
address: buildkitdNetworkProtocol + "://" + listener.Addr().String(),
|
||||
dockerAddress: d.Sock(),
|
||||
rootless: c.IsRootless,
|
||||
netnsDetached: false,
|
||||
|
||||
+11
@@ -13,6 +13,8 @@ import (
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
const buildkitdNetworkProtocol = "unix"
|
||||
|
||||
func applyBuildkitdPlatformFlags(args []string) []string {
|
||||
return append(args, "--oci-worker=false")
|
||||
}
|
||||
@@ -75,3 +77,12 @@ func normalizeAddress(address string) string {
|
||||
// for parity with windows, no effect for unix
|
||||
return address
|
||||
}
|
||||
|
||||
func applyDockerdPlatformFlags(flags []string, _ string) []string {
|
||||
flags = append(flags, "--userland-proxy=false")
|
||||
return flags
|
||||
}
|
||||
|
||||
func getBuildkitdNetworkAddr(tmpdir string) string {
|
||||
return tmpdir
|
||||
}
|
||||
|
||||
+16
@@ -4,8 +4,12 @@ import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"syscall"
|
||||
|
||||
"github.com/containerd/containerd/v2/defaults"
|
||||
)
|
||||
|
||||
const buildkitdNetworkProtocol = "tcp"
|
||||
|
||||
func applyBuildkitdPlatformFlags(args []string) []string {
|
||||
return args
|
||||
}
|
||||
@@ -55,3 +59,15 @@ func normalizeAddress(address string) string {
|
||||
}
|
||||
return address
|
||||
}
|
||||
|
||||
func applyDockerdPlatformFlags(flags []string, workerID string) []string {
|
||||
if workerID == "dockerd-containerd" {
|
||||
flags = append(flags, "--default-runtime="+defaults.DefaultRuntime)
|
||||
}
|
||||
return flags
|
||||
}
|
||||
|
||||
func getBuildkitdNetworkAddr(_ string) string {
|
||||
// Using TCP on Windows, instead of Unix sockets.
|
||||
return "localhost:0"
|
||||
}
|
||||
|
||||
+3
-3
@@ -3,7 +3,7 @@ package detect
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
"sort"
|
||||
"slices"
|
||||
"strconv"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
@@ -66,8 +66,8 @@ func detectExporter[T any](envVar string, fn func(d ExporterDetector) (T, bool,
|
||||
for _, d := range detectors {
|
||||
arr = append(arr, d)
|
||||
}
|
||||
sort.Slice(arr, func(i, j int) bool {
|
||||
return arr[i].priority < arr[j].priority
|
||||
slices.SortFunc(arr, func(a, b detector) int {
|
||||
return a.priority - b.priority
|
||||
})
|
||||
|
||||
var ok bool
|
||||
|
||||
+1
-1
@@ -72,7 +72,7 @@ func (c *client) UploadTraces(ctx context.Context, protoSpans []*tracepb.Resourc
|
||||
ctx, cancel := c.connection.ContextWithStop(ctx)
|
||||
defer func() { cancel(errors.WithStack(context.Canceled)) }()
|
||||
ctx, tCancel := context.WithCancelCause(ctx)
|
||||
ctx, _ = context.WithTimeoutCause(ctx, 30*time.Second, errors.WithStack(context.DeadlineExceeded))
|
||||
ctx, _ = context.WithTimeoutCause(ctx, 30*time.Second, errors.WithStack(context.DeadlineExceeded)) //nolint:govet
|
||||
defer tCancel(errors.WithStack(context.Canceled))
|
||||
|
||||
ctx = c.connection.ContextWithMetadata(ctx)
|
||||
|
||||
+3
-14
@@ -5,7 +5,6 @@ import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/http/httptrace"
|
||||
"slices"
|
||||
|
||||
"github.com/moby/buildkit/util/bklog"
|
||||
"github.com/moby/buildkit/util/stack"
|
||||
@@ -34,19 +33,9 @@ func StartSpan(ctx context.Context, operationName string, opts ...trace.SpanStar
|
||||
}
|
||||
|
||||
func hasStacktrace(err error) bool {
|
||||
switch e := err.(type) {
|
||||
case interface{ StackTrace() *stack.Stack }:
|
||||
return true
|
||||
case interface{ StackTrace() errors.StackTrace }:
|
||||
return true
|
||||
case interface{ Unwrap() error }:
|
||||
return hasStacktrace(e.Unwrap())
|
||||
case interface{ Unwrap() []error }:
|
||||
if slices.ContainsFunc(e.Unwrap(), hasStacktrace) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
var stack interface{ StackTrace() *stack.Stack }
|
||||
var pkgStack interface{ StackTrace() errors.StackTrace }
|
||||
return errors.As(err, &stack) || errors.As(err, &pkgStack)
|
||||
}
|
||||
|
||||
// FinishWithError finalizes the span and sets the error if one is passed
|
||||
|
||||
Reference in New Issue
Block a user