deps: update buildkit, vendor changes

Signed-off-by: Laura Brehm <laurabrehm@hey.com>
This commit is contained in:
Laura Brehm
2023-12-19 12:36:24 +00:00
parent 8484fcdd57
commit 0f45b629ad
157 changed files with 17189 additions and 1232 deletions

View File

@ -95,7 +95,7 @@ type Source struct {
type ContextOpt struct {
NoDockerignore bool
LocalOpts []llb.LocalOption
AsyncLocalOpts func() []llb.LocalOption
Platform *ocispecs.Platform
ResolveMode string
CaptureDigest *digest.Digest
@ -473,11 +473,8 @@ func (bc *Client) NamedContext(ctx context.Context, name string, opt ContextOpt)
}
pname := name + "::" + platforms.Format(platforms.Normalize(pp))
st, img, err := bc.namedContext(ctx, name, pname, opt)
if err != nil {
return nil, nil, err
}
if st != nil {
return st, img, nil
if err != nil || st != nil {
return st, img, err
}
return bc.namedContext(ctx, name, name, opt)
}

View File

@ -6,12 +6,14 @@ import (
"encoding/json"
"fmt"
"strings"
"sync"
"github.com/distribution/reference"
"github.com/moby/buildkit/client/llb"
"github.com/moby/buildkit/exporter/containerimage/exptypes"
"github.com/moby/buildkit/exporter/containerimage/image"
"github.com/moby/buildkit/frontend/gateway/client"
"github.com/moby/buildkit/solver/pb"
"github.com/moby/buildkit/util/imageutil"
"github.com/moby/patternmatcher/ignorefile"
"github.com/pkg/errors"
@ -212,12 +214,15 @@ func (bc *Client) namedContextRecursive(ctx context.Context, name string, nameWi
}
}
}
st = llb.Local(vv[1],
llb.WithCustomName("[context "+nameWithPlatform+"] load from client"),
llb.SessionID(bc.bopts.SessionID),
llb.SharedKeyHint("context:"+nameWithPlatform),
llb.ExcludePatterns(excludes),
)
localOutput := &asyncLocalOutput{
name: vv[1],
nameWithPlatform: nameWithPlatform,
sessionID: bc.bopts.SessionID,
excludes: excludes,
extraOpts: opt.AsyncLocalOpts,
}
st = llb.NewState(localOutput)
return &st, nil, nil
case "input":
inputs, err := bc.client.Inputs(ctx)
@ -251,3 +256,41 @@ func (bc *Client) namedContextRecursive(ctx context.Context, name string, nameWi
return nil, nil, errors.Errorf("unsupported context source %s for %s", vv[0], nameWithPlatform)
}
}
// asyncLocalOutput is an llb.Output that computes an llb.Local
// on-demand instead of at the time of initialization.
type asyncLocalOutput struct {
llb.Output
name string
nameWithPlatform string
sessionID string
excludes []string
extraOpts func() []llb.LocalOption
once sync.Once
}
func (a *asyncLocalOutput) ToInput(ctx context.Context, constraints *llb.Constraints) (*pb.Input, error) {
a.once.Do(a.do)
return a.Output.ToInput(ctx, constraints)
}
func (a *asyncLocalOutput) Vertex(ctx context.Context, constraints *llb.Constraints) llb.Vertex {
a.once.Do(a.do)
return a.Output.Vertex(ctx, constraints)
}
func (a *asyncLocalOutput) do() {
var extraOpts []llb.LocalOption
if a.extraOpts != nil {
extraOpts = a.extraOpts()
}
opts := append([]llb.LocalOption{
llb.WithCustomName("[context " + a.nameWithPlatform + "] load from client"),
llb.SessionID(a.sessionID),
llb.SharedKeyHint("context:" + a.nameWithPlatform),
llb.ExcludePatterns(a.excludes),
}, extraOpts...)
st := llb.Local(a.name, opts...)
a.Output = st.Output()
}

View File

@ -43,8 +43,9 @@ 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.WithTimeout(ctx, 15*time.Second)
defer pingCancel()
pingCtx, pingCancel := context.WithCancelCause(ctx)
pingCtx, _ = context.WithTimeoutCause(pingCtx, 15*time.Second, errors.WithStack(context.DeadlineExceeded))
defer pingCancel(errors.WithStack(context.Canceled))
resp, err := c.Ping(pingCtx, &pb.PingRequest{})
if err != nil {
return nil, err
@ -616,7 +617,7 @@ func (b *procMessageForwarder) Close() {
type messageForwarder struct {
client pb.LLBBridgeClient
ctx context.Context
cancel func()
cancel func(error)
eg *errgroup.Group
mu sync.Mutex
pids map[string]*procMessageForwarder
@ -630,7 +631,7 @@ type messageForwarder struct {
}
func newMessageForwarder(ctx context.Context, client pb.LLBBridgeClient) *messageForwarder {
ctx, cancel := context.WithCancel(ctx)
ctx, cancel := context.WithCancelCause(ctx)
eg, ctx := errgroup.WithContext(ctx)
return &messageForwarder{
client: client,
@ -719,7 +720,7 @@ func (m *messageForwarder) Send(msg *pb.ExecMessage) error {
}
func (m *messageForwarder) Release() error {
m.cancel()
m.cancel(errors.WithStack(context.Canceled))
return m.eg.Wait()
}
@ -949,7 +950,7 @@ func (ctr *container) Start(ctx context.Context, req client.StartRequest) (clien
closeDoneOnce.Do(func() {
close(done)
})
return ctx.Err()
return context.Cause(ctx)
}
if file := msg.GetFile(); file != nil {
@ -1145,7 +1146,7 @@ func grpcClientConn(ctx context.Context) (context.Context, *grpc.ClientConn, err
return nil, nil, errors.Wrap(err, "failed to create grpc client")
}
ctx, cancel := context.WithCancel(ctx)
ctx, cancel := context.WithCancelCause(ctx)
_ = cancel
// go monitorHealth(ctx, cc, cancel)