mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-09 21:17:09 +08:00
vendor: update buildkit to master@cbfd4023383d
Signed-off-by: Justin Chadwell <me@jedevc.com>
This commit is contained in:
4
vendor/github.com/moby/buildkit/util/testutil/workers/containerd.go
generated
vendored
4
vendor/github.com/moby/buildkit/util/testutil/workers/containerd.go
generated
vendored
@ -168,7 +168,7 @@ disabled_plugins = ["cri"]
|
||||
containerdArgs := []string{c.Containerd, "--config", configFile}
|
||||
rootlessKitState := filepath.Join(tmpdir, "rootlesskit-containerd")
|
||||
if rootless {
|
||||
containerdArgs = append(append([]string{"sudo", "-E", "-u", fmt.Sprintf("#%d", c.UID), "-i",
|
||||
containerdArgs = append(append([]string{"sudo", "-u", fmt.Sprintf("#%d", c.UID), "-i",
|
||||
fmt.Sprintf("CONTAINERD_ROOTLESS_ROOTLESSKIT_STATE_DIR=%s", rootlessKitState),
|
||||
// Integration test requires the access to localhost of the host network namespace.
|
||||
// TODO: remove these configurations
|
||||
@ -211,7 +211,7 @@ disabled_plugins = ["cri"]
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
buildkitdArgs = append([]string{"sudo", "-E", "-u", fmt.Sprintf("#%d", c.UID), "-i", "--", "exec",
|
||||
buildkitdArgs = append([]string{"sudo", "-u", fmt.Sprintf("#%d", c.UID), "-i", "--", "exec",
|
||||
"nsenter", "-U", "--preserve-credentials", "-m", "-t", fmt.Sprintf("%d", pid)},
|
||||
append(buildkitdArgs, "--containerd-worker-snapshotter=native")...)
|
||||
}
|
||||
|
32
vendor/github.com/moby/buildkit/util/testutil/workers/dockerd.go
generated
vendored
32
vendor/github.com/moby/buildkit/util/testutil/workers/dockerd.go
generated
vendored
@ -76,9 +76,27 @@ func (c Moby) New(ctx context.Context, cfg *integration.BackendConfig) (b integr
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
bkcfg, err := config.LoadFile(cfg.ConfigFile)
|
||||
deferF := &integration.MultiCloser{}
|
||||
cl = deferF.F()
|
||||
|
||||
defer func() {
|
||||
if err != nil {
|
||||
deferF.F()()
|
||||
cl = nil
|
||||
}
|
||||
}()
|
||||
|
||||
cfgFile, err := integration.WriteConfig(cfg.DaemonConfig)
|
||||
if err != nil {
|
||||
return nil, nil, errors.Wrapf(err, "failed to load buildkit config file %s", cfg.ConfigFile)
|
||||
return nil, nil, err
|
||||
}
|
||||
deferF.Append(func() error {
|
||||
return os.RemoveAll(filepath.Dir(cfgFile))
|
||||
})
|
||||
|
||||
bkcfg, err := config.LoadFile(cfgFile)
|
||||
if err != nil {
|
||||
return nil, nil, errors.Wrapf(err, "failed to load buildkit config file %s", cfgFile)
|
||||
}
|
||||
|
||||
dcfg := dockerd.Config{
|
||||
@ -107,16 +125,6 @@ func (c Moby) New(ctx context.Context, cfg *integration.BackendConfig) (b integr
|
||||
return nil, nil, errors.Wrapf(err, "failed to marshal dockerd config")
|
||||
}
|
||||
|
||||
deferF := &integration.MultiCloser{}
|
||||
cl = deferF.F()
|
||||
|
||||
defer func() {
|
||||
if err != nil {
|
||||
deferF.F()()
|
||||
cl = nil
|
||||
}
|
||||
}()
|
||||
|
||||
var proxyGroup errgroup.Group
|
||||
deferF.Append(proxyGroup.Wait)
|
||||
|
||||
|
4
vendor/github.com/moby/buildkit/util/testutil/workers/features.go
generated
vendored
4
vendor/github.com/moby/buildkit/util/testutil/workers/features.go
generated
vendored
@ -61,3 +61,7 @@ var features = map[string]struct{}{
|
||||
func CheckFeatureCompat(t *testing.T, sb integration.Sandbox, reason ...string) {
|
||||
integration.CheckFeatureCompat(t, sb, features, reason...)
|
||||
}
|
||||
|
||||
func HasFeatureCompat(t *testing.T, sb integration.Sandbox, reason ...string) error {
|
||||
return integration.HasFeatureCompat(t, sb, features, reason...)
|
||||
}
|
||||
|
2
vendor/github.com/moby/buildkit/util/testutil/workers/oci.go
generated
vendored
2
vendor/github.com/moby/buildkit/util/testutil/workers/oci.go
generated
vendored
@ -66,7 +66,7 @@ func (s *OCI) New(ctx context.Context, cfg *integration.BackendConfig) (integrat
|
||||
return nil, nil, errors.Errorf("unsupported id pair: uid=%d, gid=%d", s.UID, s.GID)
|
||||
}
|
||||
// TODO: make sure the user exists and subuid/subgid are configured.
|
||||
buildkitdArgs = append([]string{"sudo", "-E", "-u", fmt.Sprintf("#%d", s.UID), "-i", "--", "exec", "rootlesskit"}, buildkitdArgs...)
|
||||
buildkitdArgs = append([]string{"sudo", "-u", fmt.Sprintf("#%d", s.UID), "-i", "--", "exec", "rootlesskit"}, buildkitdArgs...)
|
||||
}
|
||||
|
||||
var extraEnv []string
|
||||
|
31
vendor/github.com/moby/buildkit/util/testutil/workers/util.go
generated
vendored
31
vendor/github.com/moby/buildkit/util/testutil/workers/util.go
generated
vendored
@ -4,6 +4,7 @@ import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
@ -32,10 +33,6 @@ func runBuildkitd(ctx context.Context, conf *integration.BackendConfig, args []s
|
||||
}
|
||||
}()
|
||||
|
||||
if conf.ConfigFile != "" {
|
||||
args = append(args, "--config="+conf.ConfigFile)
|
||||
}
|
||||
|
||||
tmpdir, err := os.MkdirTemp("", "bktest_buildkitd")
|
||||
if err != nil {
|
||||
return "", nil, err
|
||||
@ -49,14 +46,22 @@ func runBuildkitd(ctx context.Context, conf *integration.BackendConfig, args []s
|
||||
if err := os.Chown(filepath.Join(tmpdir, "tmp"), uid, gid); err != nil {
|
||||
return "", nil, err
|
||||
}
|
||||
|
||||
deferF.Append(func() error { return os.RemoveAll(tmpdir) })
|
||||
|
||||
cfgfile, err := integration.WriteConfig(append(conf.DaemonConfig, withOTELSocketPath(getTraceSocketPath(tmpdir))))
|
||||
if err != nil {
|
||||
return "", nil, err
|
||||
}
|
||||
deferF.Append(func() error {
|
||||
return os.RemoveAll(filepath.Dir(cfgfile))
|
||||
})
|
||||
args = append(args, "--config="+cfgfile)
|
||||
|
||||
address = getBuildkitdAddr(tmpdir)
|
||||
|
||||
args = append(args, "--root", tmpdir, "--addr", address, "--debug")
|
||||
cmd := exec.Command(args[0], args[1:]...) //nolint:gosec // test utility
|
||||
cmd.Env = append(os.Environ(), "BUILDKIT_DEBUG_EXEC_OUTPUT=1", "BUILDKIT_DEBUG_PANIC_ON_ERROR=1", "BUILDKIT_TRACE_SOCKET="+getTraceSocketPath(tmpdir), "TMPDIR="+filepath.Join(tmpdir, "tmp"))
|
||||
cmd.Env = append(os.Environ(), "BUILDKIT_DEBUG_EXEC_OUTPUT=1", "BUILDKIT_DEBUG_PANIC_ON_ERROR=1", "TMPDIR="+filepath.Join(tmpdir, "tmp"))
|
||||
cmd.Env = append(cmd.Env, extraEnv...)
|
||||
cmd.SysProcAttr = getSysProcAttr()
|
||||
|
||||
@ -87,3 +92,17 @@ func runBuildkitd(ctx context.Context, conf *integration.BackendConfig, args []s
|
||||
|
||||
return address, cl, err
|
||||
}
|
||||
|
||||
func withOTELSocketPath(socketPath string) integration.ConfigUpdater {
|
||||
return otelSocketPath(socketPath)
|
||||
}
|
||||
|
||||
type otelSocketPath string
|
||||
|
||||
func (osp otelSocketPath) UpdateConfigFile(in string) string {
|
||||
return fmt.Sprintf(`%s
|
||||
|
||||
[otel]
|
||||
socketPath = %q
|
||||
`, in, osp)
|
||||
}
|
||||
|
Reference in New Issue
Block a user