cache: Disable overlay diff for native snapshotter
Before this change, test cases were running with an env var that forces the overlay differ to be on even when the native snapshotter was being used, which resulted in failures. Now, that env var is skipped when using the native snapshotter. Additionally, this includes a related change to skip even trying to use the overlay differ when the native snapshotter is in use. Previously, the blob creation code first tried to use the overlay differ and then failed and fell back to the double-walking differ. Now, it just jumps right to the double-walking differ when the native snapshotter is in use. Signed-off-by: Erik Sipsma <erik@sipsma.dev>master
parent
2bfad4b0dc
commit
abf373a3b6
|
@ -137,7 +137,7 @@ func computeBlobChain(ctx context.Context, sr *immutableRef, createIfNeeded bool
|
||||||
case "overlayfs", "stargz":
|
case "overlayfs", "stargz":
|
||||||
// overlayfs-based snapshotters should support overlay diff. so print warn log on failure.
|
// overlayfs-based snapshotters should support overlay diff. so print warn log on failure.
|
||||||
logWarnOnErr = true
|
logWarnOnErr = true
|
||||||
case "fuse-overlayfs":
|
case "fuse-overlayfs", "native":
|
||||||
// not supported with fuse-overlayfs snapshotter which doesn't provide overlayfs mounts.
|
// not supported with fuse-overlayfs snapshotter which doesn't provide overlayfs mounts.
|
||||||
// TODO: add support for fuse-overlayfs
|
// TODO: add support for fuse-overlayfs
|
||||||
enableOverlay = false
|
enableOverlay = false
|
||||||
|
|
|
@ -9,6 +9,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -148,6 +149,9 @@ disabled_plugins = ["cri"]
|
||||||
"--containerd-worker-labels=org.mobyproject.buildkit.worker.sandbox=true", // Include use of --containerd-worker-labels to trigger https://github.com/moby/buildkit/pull/603
|
"--containerd-worker-labels=org.mobyproject.buildkit.worker.sandbox=true", // Include use of --containerd-worker-labels to trigger https://github.com/moby/buildkit/pull/603
|
||||||
}, snBuildkitdArgs...)
|
}, snBuildkitdArgs...)
|
||||||
|
|
||||||
|
if runtime.GOOS != "windows" && c.snapshotter != "native" {
|
||||||
|
c.extraEnv = append(c.extraEnv, "BUILDKIT_DEBUG_FORCE_OVERLAY_DIFF=true")
|
||||||
|
}
|
||||||
buildkitdSock, stop, err := runBuildkitd(ctx, cfg, buildkitdArgs, cfg.Logs, 0, 0, c.extraEnv)
|
buildkitdSock, stop, err := runBuildkitd(ctx, cfg, buildkitdArgs, cfg.Logs, 0, 0, c.extraEnv)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
printLogs(cfg.Logs, log.Println)
|
printLogs(cfg.Logs, log.Println)
|
||||||
|
|
|
@ -5,6 +5,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
|
"runtime"
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
|
@ -68,7 +69,11 @@ func (s *oci) New(ctx context.Context, cfg *BackendConfig) (Backend, func() erro
|
||||||
buildkitdArgs = append([]string{"sudo", "-u", fmt.Sprintf("#%d", s.uid), "-i", "--", "exec", "rootlesskit"}, buildkitdArgs...)
|
buildkitdArgs = append([]string{"sudo", "-u", fmt.Sprintf("#%d", s.uid), "-i", "--", "exec", "rootlesskit"}, buildkitdArgs...)
|
||||||
}
|
}
|
||||||
|
|
||||||
buildkitdSock, stop, err := runBuildkitd(ctx, cfg, buildkitdArgs, cfg.Logs, s.uid, s.gid, nil)
|
var extraEnv []string
|
||||||
|
if runtime.GOOS != "windows" && s.snapshotter != "native" {
|
||||||
|
extraEnv = append(extraEnv, "BUILDKIT_DEBUG_FORCE_OVERLAY_DIFF=true")
|
||||||
|
}
|
||||||
|
buildkitdSock, stop, err := runBuildkitd(ctx, cfg, buildkitdArgs, cfg.Logs, s.uid, s.gid, extraEnv)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
printLogs(cfg.Logs, log.Println)
|
printLogs(cfg.Logs, log.Println)
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
|
|
|
@ -182,9 +182,6 @@ func runBuildkitd(ctx context.Context, conf *BackendConfig, args []string, logs
|
||||||
args = append(args, "--root", tmpdir, "--addr", address, "--debug")
|
args = append(args, "--root", tmpdir, "--addr", address, "--debug")
|
||||||
cmd := exec.Command(args[0], args[1:]...)
|
cmd := exec.Command(args[0], args[1:]...)
|
||||||
cmd.Env = append(os.Environ(), "BUILDKIT_DEBUG_EXEC_OUTPUT=1", "BUILDKIT_DEBUG_PANIC_ON_ERROR=1", "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"))
|
||||||
if runtime.GOOS != "windows" {
|
|
||||||
cmd.Env = append(cmd.Env, "BUILDKIT_DEBUG_FORCE_OVERLAY_DIFF=true")
|
|
||||||
}
|
|
||||||
cmd.Env = append(cmd.Env, extraEnv...)
|
cmd.Env = append(cmd.Env, extraEnv...)
|
||||||
cmd.SysProcAttr = getSysProcAttr()
|
cmd.SysProcAttr = getSysProcAttr()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue