Merge pull request #2069 from AkihiroSuda/carry-2001
[Carry 2001] Dockerfile: update containerd to 1.4.3 + fix testutilv0.9
commit
33b56587e9
|
@ -1,7 +1,7 @@
|
|||
# syntax = docker/dockerfile:1.2
|
||||
|
||||
ARG RUNC_VERSION=v1.0.0-rc93
|
||||
ARG CONTAINERD_VERSION=v1.4.2
|
||||
ARG CONTAINERD_VERSION=v1.4.3
|
||||
# containerd v1.3 for integration tests
|
||||
ARG CONTAINERD_ALT_VERSION=v1.3.7
|
||||
# available targets: buildkitd, buildkitd.oci_only, buildkitd.containerd_only
|
||||
|
|
|
@ -18,7 +18,6 @@ func InitContainerdWorker() {
|
|||
Register(&containerd{
|
||||
name: "containerd",
|
||||
containerd: "containerd",
|
||||
containerdShim: "containerd-shim-runc-v2",
|
||||
})
|
||||
// defined in Dockerfile
|
||||
// e.g. `containerd-1.1=/opt/containerd-1.1/bin,containerd-42.0=/opt/containerd-42.0/bin`
|
||||
|
@ -33,7 +32,8 @@ func InitContainerdWorker() {
|
|||
Register(&containerd{
|
||||
name: name,
|
||||
containerd: filepath.Join(bin, "containerd"),
|
||||
containerdShim: filepath.Join(bin, "containerd-shim-runc-v2"),
|
||||
// override PATH to make sure that the expected version of the shim binary is used
|
||||
extraEnv: []string{fmt.Sprintf("PATH=%s:%s", bin, os.Getenv("PATH"))},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,6 @@ func InitContainerdWorker() {
|
|||
Register(&containerd{
|
||||
name: fmt.Sprintf("containerd-snapshotter-%s", s),
|
||||
containerd: "containerd",
|
||||
containerdShim: "containerd-shim-runc-v2",
|
||||
snapshotter: s,
|
||||
})
|
||||
}
|
||||
|
@ -51,8 +50,8 @@ func InitContainerdWorker() {
|
|||
type containerd struct {
|
||||
name string
|
||||
containerd string
|
||||
containerdShim string
|
||||
snapshotter string
|
||||
extraEnv []string // e.g. "PATH=/opt/containerd-1.4/bin:/usr/bin:..."
|
||||
}
|
||||
|
||||
func (c *containerd) Name() string {
|
||||
|
@ -63,9 +62,6 @@ func (c *containerd) New(cfg *BackendConfig) (b Backend, cl func() error, err er
|
|||
if err := lookupBinary(c.containerd); err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
if err := lookupBinary(c.containerdShim); err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
if err := lookupBinary("buildkitd"); err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
@ -103,11 +99,7 @@ disabled_plugins = ["cri"]
|
|||
[debug]
|
||||
level = "debug"
|
||||
address = %q
|
||||
|
||||
[plugins]
|
||||
[plugins.linux]
|
||||
shim = %q
|
||||
`, filepath.Join(tmpdir, "root"), filepath.Join(tmpdir, "state"), address, filepath.Join(tmpdir, "debug.sock"), c.containerdShim)
|
||||
`, filepath.Join(tmpdir, "root"), filepath.Join(tmpdir, "state"), address, filepath.Join(tmpdir, "debug.sock"))
|
||||
|
||||
var snBuildkitdArgs []string
|
||||
if c.snapshotter != "" {
|
||||
|
@ -135,6 +127,7 @@ disabled_plugins = ["cri"]
|
|||
}
|
||||
|
||||
cmd := exec.Command(c.containerd, "--config", configFile)
|
||||
cmd.Env = append(os.Environ(), c.extraEnv...)
|
||||
|
||||
ctdStop, err := startCmd(cmd, cfg.Logs)
|
||||
if err != nil {
|
||||
|
@ -154,7 +147,7 @@ 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
|
||||
}, snBuildkitdArgs...)
|
||||
|
||||
buildkitdSock, stop, err := runBuildkitd(cfg, buildkitdArgs, cfg.Logs, 0, 0)
|
||||
buildkitdSock, stop, err := runBuildkitd(cfg, buildkitdArgs, cfg.Logs, 0, 0, c.extraEnv)
|
||||
if err != nil {
|
||||
printLogs(cfg.Logs, log.Println)
|
||||
return nil, nil, err
|
||||
|
|
|
@ -67,7 +67,7 @@ func (s *oci) New(cfg *BackendConfig) (Backend, func() error, error) {
|
|||
buildkitdArgs = append([]string{"sudo", "-u", fmt.Sprintf("#%d", s.uid), "-i", "--", "exec", "rootlesskit"}, buildkitdArgs...)
|
||||
}
|
||||
|
||||
buildkitdSock, stop, err := runBuildkitd(cfg, buildkitdArgs, cfg.Logs, s.uid, s.gid)
|
||||
buildkitdSock, stop, err := runBuildkitd(cfg, buildkitdArgs, cfg.Logs, s.uid, s.gid, nil)
|
||||
if err != nil {
|
||||
printLogs(cfg.Logs, log.Println)
|
||||
return nil, nil, err
|
||||
|
|
|
@ -139,7 +139,7 @@ func getBuildkitdAddr(tmpdir string) string {
|
|||
return address
|
||||
}
|
||||
|
||||
func runBuildkitd(conf *BackendConfig, args []string, logs map[string]*bytes.Buffer, uid, gid int) (address string, cl func() error, err error) {
|
||||
func runBuildkitd(conf *BackendConfig, args []string, logs map[string]*bytes.Buffer, uid, gid int, extraEnv []string) (address string, cl func() error, err error) {
|
||||
deferF := &multiCloser{}
|
||||
cl = deferF.F()
|
||||
|
||||
|
@ -175,6 +175,7 @@ func runBuildkitd(conf *BackendConfig, args []string, logs map[string]*bytes.Buf
|
|||
args = append(args, "--root", tmpdir, "--addr", address, "--debug")
|
||||
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(cmd.Env, extraEnv...)
|
||||
cmd.SysProcAttr = getSysProcAttr()
|
||||
|
||||
stop, err := startCmd(cmd, logs)
|
||||
|
|
Loading…
Reference in New Issue