vendor: update buildkit to b124b0c3

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
Tonis Tiigi
2022-02-23 12:15:16 -08:00
parent 10debb577e
commit 64ce211ba4
27 changed files with 415 additions and 180 deletions

View File

@ -44,7 +44,13 @@ func (c *Client) Build(ctx context.Context, opt SolveOpt, product string, buildF
})
}
cb := func(ref string, s *session.Session) error {
cb := func(ref string, s *session.Session, opts map[string]string) error {
for k, v := range opts {
if feOpts == nil {
feOpts = map[string]string{}
}
feOpts[k] = v
}
gwClient := c.gatewayClientForBuild(ref)
g, err := grpcclient.New(ctx, feOpts, s.ID(), product, gwClient, gworkers)
if err != nil {

View File

@ -75,7 +75,7 @@ func (c *Client) Solve(ctx context.Context, def *llb.Definition, opt SolveOpt, s
return c.solve(ctx, def, nil, opt, statusChan)
}
type runGatewayCB func(ref string, s *session.Session) error
type runGatewayCB func(ref string, s *session.Session, opts map[string]string) error
func (c *Client) solve(ctx context.Context, def *llb.Definition, runGateway runGatewayCB, opt SolveOpt, statusChan chan *SolveStatus) (*SolveResponse, error) {
if def != nil && runGateway != nil {
@ -109,7 +109,7 @@ func (c *Client) solve(ctx context.Context, def *llb.Definition, runGateway runG
}
}
cacheOpt, err := parseCacheOptions(ctx, opt)
cacheOpt, err := parseCacheOptions(ctx, runGateway != nil, opt)
if err != nil {
return nil, err
}
@ -171,6 +171,9 @@ func (c *Client) solve(ctx context.Context, def *llb.Definition, runGateway runG
}
for k, v := range cacheOpt.frontendAttrs {
if opt.FrontendAttrs == nil {
opt.FrontendAttrs = map[string]string{}
}
opt.FrontendAttrs[k] = v
}
@ -225,7 +228,7 @@ func (c *Client) solve(ctx context.Context, def *llb.Definition, runGateway runG
if runGateway != nil {
eg.Go(func() error {
err := runGateway(ref, s)
err := runGateway(ref, s, opt.FrontendAttrs)
if err == nil {
return nil
}
@ -386,7 +389,7 @@ type cacheOptions struct {
frontendAttrs map[string]string
}
func parseCacheOptions(ctx context.Context, opt SolveOpt) (*cacheOptions, error) {
func parseCacheOptions(ctx context.Context, isGateway bool, opt SolveOpt) (*cacheOptions, error) {
var (
cacheExports []*controlapi.CacheOptionsEntry
cacheImports []*controlapi.CacheOptionsEntry
@ -471,7 +474,7 @@ func parseCacheOptions(ctx context.Context, opt SolveOpt) (*cacheOptions, error)
})
}
}
if opt.Frontend != "" {
if opt.Frontend != "" || isGateway {
// use legacy API for registry importers, because the frontend might not support the new API
if len(legacyImportRefs) > 0 {
frontendAttrs["cache-from"] = strings.Join(legacyImportRefs, ",")

View File

@ -99,6 +99,8 @@ type ContainerdConfig struct {
ApparmorProfile string `toml:"apparmor-profile"`
MaxParallelism int `toml:"max-parallelism"`
Rootless bool `toml:"rootless"`
}
type GCPolicy struct {

View File

@ -341,6 +341,24 @@ func (c *grpcClient) Solve(ctx context.Context, creq client.SolveRequest) (res *
}
}
// these options are added by go client in solve()
if _, ok := creq.FrontendOpt["cache-imports"]; !ok {
if v, ok := c.opts["cache-imports"]; ok {
if creq.FrontendOpt == nil {
creq.FrontendOpt = map[string]string{}
}
creq.FrontendOpt["cache-imports"] = v
}
}
if _, ok := creq.FrontendOpt["cache-from"]; !ok {
if v, ok := c.opts["cache-from"]; ok {
if creq.FrontendOpt == nil {
creq.FrontendOpt = map[string]string{}
}
creq.FrontendOpt["cache-from"] = v
}
}
req := &pb.SolveRequest{
Definition: creq.Definition,
Frontend: creq.Frontend,

View File

@ -3,10 +3,17 @@ package bklog
import (
"context"
"github.com/containerd/containerd/log"
"github.com/sirupsen/logrus"
"go.opentelemetry.io/otel/trace"
)
func init() {
// overwrites containerd/log
log.G = GetLogger
log.L = L
}
var (
G = GetLogger
L = logrus.NewEntry(logrus.StandardLogger())
@ -37,6 +44,8 @@ func GetLogger(ctx context.Context) (l *logrus.Entry) {
if logger != nil {
l = logger.(*logrus.Entry)
} else if logger := log.GetLogger(ctx); logger != nil {
l = logger
} else {
l = L
}