Skip to content

Commit

Permalink
Merge pull request moby#4068 from jedevc/remove-old-build-tags
Browse files Browse the repository at this point in the history
chore: remove old `no_{oci,containerd}_worker` build tags
  • Loading branch information
crazy-max authored Jul 28, 2023
2 parents 405f75f + 450245a commit 4733c51
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 49 deletions.
4 changes: 2 additions & 2 deletions cmd/buildkitd/main_containerd_worker.go
Original file line number Diff line number Diff line change
@@ -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

Expand Down
4 changes: 2 additions & 2 deletions cmd/buildkitd/main_oci_worker.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build linux && !no_oci_worker
// +build linux,!no_oci_worker
//go:build linux
// +build linux

package main

Expand Down
11 changes: 3 additions & 8 deletions examples/buildkit0/buildkit.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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"))

Expand All @@ -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
}
Expand Down
14 changes: 6 additions & 8 deletions examples/buildkit1/buildkit.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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()

Expand All @@ -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
Expand Down
13 changes: 6 additions & 7 deletions examples/buildkit2/buildkit.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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 {
Expand Down
13 changes: 6 additions & 7 deletions examples/buildkit3/buildkit.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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 {
Expand Down
13 changes: 3 additions & 10 deletions examples/buildkit4/buildkit.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion examples/gobuild/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions worker/containerd/containerd_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build linux && !no_containerd_worker
// +build linux,!no_containerd_worker
//go:build linux
// +build linux

package containerd

Expand Down
4 changes: 2 additions & 2 deletions worker/runc/runc_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build linux && !no_runc_worker
// +build linux,!no_runc_worker
//go:build linux
// +build linux

package runc

Expand Down

0 comments on commit 4733c51

Please sign in to comment.