mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-09 21:17:09 +08:00
vendor: update buildkit to b124b0c3
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
8
vendor/github.com/moby/buildkit/client/build.go
generated
vendored
8
vendor/github.com/moby/buildkit/client/build.go
generated
vendored
@ -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 {
|
||||
|
13
vendor/github.com/moby/buildkit/client/solve.go
generated
vendored
13
vendor/github.com/moby/buildkit/client/solve.go
generated
vendored
@ -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, ",")
|
||||
|
2
vendor/github.com/moby/buildkit/cmd/buildkitd/config/config.go
generated
vendored
2
vendor/github.com/moby/buildkit/cmd/buildkitd/config/config.go
generated
vendored
@ -99,6 +99,8 @@ type ContainerdConfig struct {
|
||||
ApparmorProfile string `toml:"apparmor-profile"`
|
||||
|
||||
MaxParallelism int `toml:"max-parallelism"`
|
||||
|
||||
Rootless bool `toml:"rootless"`
|
||||
}
|
||||
|
||||
type GCPolicy struct {
|
||||
|
18
vendor/github.com/moby/buildkit/frontend/gateway/grpcclient/client.go
generated
vendored
18
vendor/github.com/moby/buildkit/frontend/gateway/grpcclient/client.go
generated
vendored
@ -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,
|
||||
|
9
vendor/github.com/moby/buildkit/util/bklog/log.go
generated
vendored
9
vendor/github.com/moby/buildkit/util/bklog/log.go
generated
vendored
@ -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
|
||||
}
|
||||
|
58
vendor/github.com/moby/sys/mountinfo/mounted_linux.go
generated
vendored
58
vendor/github.com/moby/sys/mountinfo/mounted_linux.go
generated
vendored
@ -7,6 +7,34 @@ import (
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
// MountedFast is a method of detecting a mount point without reading
|
||||
// mountinfo from procfs. A caller can only trust the result if no error
|
||||
// and sure == true are returned. Otherwise, other methods (e.g. parsing
|
||||
// /proc/mounts) have to be used. If unsure, use Mounted instead (which
|
||||
// uses MountedFast, but falls back to parsing mountinfo if needed).
|
||||
//
|
||||
// If a non-existent path is specified, an appropriate error is returned.
|
||||
// In case the caller is not interested in this particular error, it should
|
||||
// be handled separately using e.g. errors.Is(err, os.ErrNotExist).
|
||||
//
|
||||
// This function is only available on Linux. When available (since kernel
|
||||
// v5.6), openat2(2) syscall is used to reliably detect all mounts. Otherwise,
|
||||
// the implementation falls back to using stat(2), which can reliably detect
|
||||
// normal (but not bind) mounts.
|
||||
func MountedFast(path string) (mounted, sure bool, err error) {
|
||||
// Root is always mounted.
|
||||
if path == string(os.PathSeparator) {
|
||||
return true, true, nil
|
||||
}
|
||||
|
||||
path, err = normalizePath(path)
|
||||
if err != nil {
|
||||
return false, false, err
|
||||
}
|
||||
mounted, sure, err = mountedFast(path)
|
||||
return
|
||||
}
|
||||
|
||||
// mountedByOpenat2 is a method of detecting a mount that works for all kinds
|
||||
// of mounts (incl. bind mounts), but requires a recent (v5.6+) linux kernel.
|
||||
func mountedByOpenat2(path string) (bool, error) {
|
||||
@ -34,24 +62,40 @@ func mountedByOpenat2(path string) (bool, error) {
|
||||
return false, &os.PathError{Op: "openat2", Path: path, Err: err}
|
||||
}
|
||||
|
||||
func mounted(path string) (bool, error) {
|
||||
path, err := normalizePath(path)
|
||||
if err != nil {
|
||||
return false, err
|
||||
// mountedFast is similar to MountedFast, except it expects a normalized path.
|
||||
func mountedFast(path string) (mounted, sure bool, err error) {
|
||||
// Root is always mounted.
|
||||
if path == string(os.PathSeparator) {
|
||||
return true, true, nil
|
||||
}
|
||||
|
||||
// Try a fast path, using openat2() with RESOLVE_NO_XDEV.
|
||||
mounted, err := mountedByOpenat2(path)
|
||||
mounted, err = mountedByOpenat2(path)
|
||||
if err == nil {
|
||||
return mounted, nil
|
||||
return mounted, true, nil
|
||||
}
|
||||
|
||||
// Another fast path: compare st.st_dev fields.
|
||||
mounted, err = mountedByStat(path)
|
||||
// This does not work for bind mounts, so false negative
|
||||
// is possible, therefore only trust if return is true.
|
||||
if mounted && err == nil {
|
||||
return true, true, nil
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func mounted(path string) (bool, error) {
|
||||
path, err := normalizePath(path)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
mounted, sure, err := mountedFast(path)
|
||||
if sure && err == nil {
|
||||
return mounted, nil
|
||||
}
|
||||
|
||||
// Fallback to parsing mountinfo
|
||||
// Fallback to parsing mountinfo.
|
||||
return mountedByMountinfo(path)
|
||||
}
|
||||
|
6
vendor/github.com/moby/sys/mountinfo/mountinfo.go
generated
vendored
6
vendor/github.com/moby/sys/mountinfo/mountinfo.go
generated
vendored
@ -13,9 +13,9 @@ func GetMounts(f FilterFunc) ([]*Info, error) {
|
||||
// Mounted determines if a specified path is a mount point. In case of any
|
||||
// error, false (and an error) is returned.
|
||||
//
|
||||
// The non-existent path returns an error. If a caller is not interested
|
||||
// in this particular error, it should handle it separately using e.g.
|
||||
// errors.Is(err, os.ErrNotExist).
|
||||
// If a non-existent path is specified, an appropriate error is returned.
|
||||
// In case the caller is not interested in this particular error, it should
|
||||
// be handled separately using e.g. errors.Is(err, os.ErrNotExist).
|
||||
func Mounted(path string) (bool, error) {
|
||||
// root is always mounted
|
||||
if path == string(os.PathSeparator) {
|
||||
|
Reference in New Issue
Block a user