diff --git a/cmd/buildkitd/main_containerd_worker.go b/cmd/buildkitd/main_containerd_worker.go index b9e3449d3e3d..6d76e9f9a900 100644 --- a/cmd/buildkitd/main_containerd_worker.go +++ b/cmd/buildkitd/main_containerd_worker.go @@ -1,5 +1,5 @@ -//go:build (linux && !no_containerd_worker) || (windows && !no_containerd_worker) -// +build linux,!no_containerd_worker windows,!no_containerd_worker +//go:build linux || windows +// +build linux windows package main diff --git a/cmd/buildkitd/main_oci_worker.go b/cmd/buildkitd/main_oci_worker.go index e6926bcb4e76..72a8309ec7df 100644 --- a/cmd/buildkitd/main_oci_worker.go +++ b/cmd/buildkitd/main_oci_worker.go @@ -1,5 +1,5 @@ -//go:build linux && !no_oci_worker -// +build linux,!no_oci_worker +//go:build linux +// +build linux package main diff --git a/examples/buildkit0/buildkit.go b/examples/buildkit0/buildkit.go index cbfa9f63b368..2a6c15310d5c 100644 --- a/examples/buildkit0/buildkit.go +++ b/examples/buildkit0/buildkit.go @@ -18,8 +18,8 @@ type buildOpt struct { func main() { var opt buildOpt flag.BoolVar(&opt.withContainerd, "with-containerd", true, "enable containerd worker") - flag.StringVar(&opt.containerd, "containerd", "v1.2.9", "containerd version") - flag.StringVar(&opt.runc, "runc", "v1.0.0-rc8", "runc version") + flag.StringVar(&opt.containerd, "containerd", "v1.7.2", "containerd version") + flag.StringVar(&opt.runc, "runc", "v1.1.7", "runc version") flag.Parse() bk := buildkit(opt) @@ -63,9 +63,6 @@ func buildkit(opt buildOpt) llb.State { Run(llb.Shlex("git clone https://github.com/moby/buildkit.git /go/src/github.com/moby/buildkit")). Dir("/go/src/github.com/moby/buildkit") - buildkitdOCIWorkerOnly := src. - Run(llb.Shlex("go build -o /bin/buildkitd.oci_only -tags no_containerd_worker ./cmd/buildkitd")) - buildkitd := src. Run(llb.Shlex("go build -o /bin/buildkitd ./cmd/buildkitd")) @@ -75,11 +72,9 @@ func buildkit(opt buildOpt) llb.State { r := llb.Image("docker.io/library/alpine:latest") r = copy(buildctl.Root(), "/bin/buildctl", r, "/bin/") r = copy(runc(opt.runc), "/usr/bin/runc", r, "/bin/") + r = copy(buildkitd.Root(), "/bin/buildkitd", r, "/bin/") if opt.withContainerd { r = copy(containerd(opt.containerd), "/go/src/github.com/containerd/containerd/bin/containerd", r, "/bin/") - r = copy(buildkitd.Root(), "/bin/buildkitd", r, "/bin/") - } else { - r = copy(buildkitdOCIWorkerOnly.Root(), "/bin/buildkitd.oci_only", r, "/bin/") } return r } diff --git a/examples/buildkit1/buildkit.go b/examples/buildkit1/buildkit.go index d97781c676e5..f2f9f0d9deca 100644 --- a/examples/buildkit1/buildkit.go +++ b/examples/buildkit1/buildkit.go @@ -18,8 +18,8 @@ type buildOpt struct { func main() { var opt buildOpt flag.BoolVar(&opt.withContainerd, "with-containerd", true, "enable containerd worker") - flag.StringVar(&opt.containerd, "containerd", "v1.2.9", "containerd version") - flag.StringVar(&opt.runc, "runc", "v1.0.0-rc8", "runc version") + flag.StringVar(&opt.containerd, "containerd", "v1.7.2", "containerd version") + flag.StringVar(&opt.runc, "runc", "v1.1.7", "runc version") flag.Parse() bk := buildkit(opt) @@ -58,9 +58,6 @@ func containerd(version string) llb.State { func buildkit(opt buildOpt) llb.State { src := goBuildBase().With(goFromGit("github.com/moby/buildkit", "master")) - buildkitdOCIWorkerOnly := src. - Run(llb.Shlex("go build -o /bin/buildkitd.oci_only -tags no_containerd_worker ./cmd/buildkitd")).Root() - buildkitd := src. Run(llb.Shlex("go build -o /bin/buildkitd ./cmd/buildkitd")).Root() @@ -69,15 +66,16 @@ func buildkit(opt buildOpt) llb.State { r := llb.Image("docker.io/library/alpine:latest").With( copyFrom(buildctl, "/bin/buildctl", "/bin/"), + copyFrom(buildkitd, "/bin/buildkitd", "/bin/"), copyFrom(runc(opt.runc), "/usr/bin/runc", "/bin/"), ) if opt.withContainerd { - return r.With( + r = r.With( copyFrom(containerd(opt.containerd), "/go/src/github.com/containerd/containerd/bin/containerd", "/bin/"), - copyFrom(buildkitd, "/bin/buildkitd", "/bin/")) + ) } - return r.With(copyFrom(buildkitdOCIWorkerOnly, "/bin/buildkitd.oci_only", "/bin/")) + return r } // goFromGit is a helper for cloning a git repo, checking out a tag and copying diff --git a/examples/buildkit2/buildkit.go b/examples/buildkit2/buildkit.go index 757270eb4660..9a2093264f81 100644 --- a/examples/buildkit2/buildkit.go +++ b/examples/buildkit2/buildkit.go @@ -18,8 +18,8 @@ type buildOpt struct { func main() { var opt buildOpt flag.BoolVar(&opt.withContainerd, "with-containerd", true, "enable containerd worker") - flag.StringVar(&opt.containerd, "containerd", "v1.2.9", "containerd version") - flag.StringVar(&opt.runc, "runc", "v1.0.0-rc8", "runc version") + flag.StringVar(&opt.containerd, "containerd", "v1.7.2", "containerd version") + flag.StringVar(&opt.runc, "runc", "v1.1.7", "runc version") flag.Parse() bk := buildkit(opt) @@ -67,23 +67,22 @@ func containerd(version string) llb.State { func buildkit(opt buildOpt) llb.State { run := goRepo(goBuildBase(), "github.com/moby/buildkit", "master") - buildkitdOCIWorkerOnly := run(llb.Shlex("go build -o ./bin/buildkitd.oci_only -tags no_containerd_worker ./cmd/buildkitd")) - buildkitd := run(llb.Shlex("go build -o ./bin/buildkitd ./cmd/buildkitd")) buildctl := run(llb.Shlex("go build -o ./bin/buildctl ./cmd/buildctl")) r := llb.Image("docker.io/library/alpine:latest").With( copyAll(buildctl, "/bin"), + copyAll(buildkitd, "/bin"), copyAll(runc(opt.runc), "/bin"), ) if opt.withContainerd { - return r.With( + r = r.With( copyAll(containerd(opt.containerd), "/bin"), - copyAll(buildkitd, "/bin")) + ) } - return r.With(copyAll(buildkitdOCIWorkerOnly, "/bin")) + return r } func copyAll(src llb.State, destPath string) llb.StateOption { diff --git a/examples/buildkit3/buildkit.go b/examples/buildkit3/buildkit.go index b239312e33e5..654c3ae1d238 100644 --- a/examples/buildkit3/buildkit.go +++ b/examples/buildkit3/buildkit.go @@ -19,8 +19,8 @@ type buildOpt struct { func main() { var opt buildOpt flag.BoolVar(&opt.withContainerd, "with-containerd", true, "enable containerd worker") - flag.StringVar(&opt.containerd, "containerd", "v1.2.9", "containerd version") - flag.StringVar(&opt.runc, "runc", "v1.0.0-rc8", "runc version") + flag.StringVar(&opt.containerd, "containerd", "v1.7.2", "containerd version") + flag.StringVar(&opt.runc, "runc", "v1.1.7", "runc version") flag.StringVar(&opt.buildkit, "buildkit", "master", "buildkit version") flag.Parse() @@ -83,23 +83,22 @@ func buildkit(opt buildOpt) llb.State { } run := goRepo(goBuildBase(), repo, src) - buildkitdOCIWorkerOnly := run(llb.Shlex("go build -o /out/buildkitd.oci_only -tags no_containerd_worker ./cmd/buildkitd")) - buildkitd := run(llb.Shlex("go build -o /out/buildkitd ./cmd/buildkitd")) buildctl := run(llb.Shlex("go build -o /out/buildctl ./cmd/buildctl")) r := llb.Scratch().With( copyAll(buildctl, "/"), + copyAll(buildkitd, "/"), copyAll(runc(opt.runc), "/"), ) if opt.withContainerd { - return r.With( + r = r.With( copyAll(containerd(opt.containerd), "/"), - copyAll(buildkitd, "/")) + ) } - return r.With(copyAll(buildkitdOCIWorkerOnly, "/")) + return r } func copyAll(src llb.State, destPath string) llb.StateOption { diff --git a/examples/buildkit4/buildkit.go b/examples/buildkit4/buildkit.go index 9513e7815a5f..7fb97b2335d8 100644 --- a/examples/buildkit4/buildkit.go +++ b/examples/buildkit4/buildkit.go @@ -21,8 +21,8 @@ type buildOpt struct { func main() { var opt buildOpt flag.BoolVar(&opt.withContainerd, "with-containerd", true, "enable containerd worker") - flag.StringVar(&opt.containerd, "containerd", "v1.5.9", "containerd version") - flag.StringVar(&opt.runc, "runc", "v1.1.0", "runc version") + flag.StringVar(&opt.containerd, "containerd", "v1.7.2", "containerd version") + flag.StringVar(&opt.runc, "runc", "v1.1.7", "runc version") flag.StringVar(&opt.buildkit, "buildkit", "master", "buildkit version") flag.StringVar(&opt.installPrefix, "prefix", "/usr/local/bin", "path under which binaries should be installed") flag.Parse() @@ -86,21 +86,14 @@ func buildkit(opt buildOpt) llb.State { } run := goRepo(goBuildBase(), repo, src) - buildkitdOCIWorkerOnly := prefixed( - run(llb.Shlex("go build -o /out/buildkitd.oci_only -tags no_containerd_worker ./cmd/buildkitd")), - opt.installPrefix, - ) - buildkitd := prefixed(run(llb.Shlex("go build -o /out/buildkitd ./cmd/buildkitd")), opt.installPrefix) buildctl := prefixed(run(llb.Shlex("go build -o /out/buildctl ./cmd/buildctl")), opt.installPrefix) - inputs := []llb.State{buildctl, prefixed(runc(opt.runc), opt.installPrefix)} + inputs := []llb.State{buildctl, buildkitd, prefixed(runc(opt.runc), opt.installPrefix)} if opt.withContainerd { inputs = append(inputs, prefixed(containerd(opt.containerd), opt.installPrefix), buildkitd) - } else { - inputs = append(inputs, buildkitdOCIWorkerOnly) } return llb.Merge(inputs) } diff --git a/examples/gobuild/main.go b/examples/gobuild/main.go index c110d293832b..8754a78a03f9 100644 --- a/examples/gobuild/main.go +++ b/examples/gobuild/main.go @@ -36,7 +36,7 @@ func run() error { Source: src, MountPath: "/go/src/github.com/moby/buildkit", Pkg: "github.com/moby/buildkit/cmd/buildkitd", - BuildTags: []string{"no_containerd_worker"}, + BuildTags: []string{}, }) if err != nil { return err diff --git a/worker/containerd/containerd_test.go b/worker/containerd/containerd_test.go index d0ea5bc012e4..0702aef5c4be 100644 --- a/worker/containerd/containerd_test.go +++ b/worker/containerd/containerd_test.go @@ -1,5 +1,5 @@ -//go:build linux && !no_containerd_worker -// +build linux,!no_containerd_worker +//go:build linux +// +build linux package containerd diff --git a/worker/runc/runc_test.go b/worker/runc/runc_test.go index 3ca4a68090ae..b6b0ddd0981b 100644 --- a/worker/runc/runc_test.go +++ b/worker/runc/runc_test.go @@ -1,5 +1,5 @@ -//go:build linux && !no_runc_worker -// +build linux,!no_runc_worker +//go:build linux +// +build linux package runc