From 2f2b72989cef423ec34da78a4b853a259de8e76c Mon Sep 17 00:00:00 2001 From: Akihiro Suda Date: Mon, 18 Dec 2017 16:33:02 +0900 Subject: [PATCH] *: buildd -> buildkitd Signed-off-by: Akihiro Suda --- Makefile | 4 +- README.md | 12 +++--- client/client.go | 2 +- cmd/{buildd => buildkitd}/debug.go | 0 cmd/{buildd => buildkitd}/main.go | 4 +- .../main_containerd_worker.go | 0 cmd/{buildd => buildkitd}/main_oci_worker.go | 0 cmd/{buildd => buildkitd}/util.go | 0 examples/buildkit0/buildkit.go | 12 +++--- examples/buildkit1/buildkit.go | 12 +++--- examples/buildkit2/buildkit.go | 8 ++-- examples/buildkit3/buildkit.go | 8 ++-- examples/gobuild/main.go | 8 ++-- hack/dockerfiles/test.Dockerfile | 42 +++++++++---------- util/appdefaults/appdefaults_unix.go | 2 +- util/appdefaults/appdefaults_windows.go | 2 +- util/testutil/integration/containerd.go | 6 +-- util/testutil/integration/oci.go | 14 +++---- 18 files changed, 68 insertions(+), 68 deletions(-) rename cmd/{buildd => buildkitd}/debug.go (100%) rename cmd/{buildd => buildkitd}/main.go (98%) rename cmd/{buildd => buildkitd}/main_containerd_worker.go (100%) rename cmd/{buildd => buildkitd}/main_oci_worker.go (100%) rename cmd/{buildd => buildkitd}/util.go (100%) diff --git a/Makefile b/Makefile index 072b3c9b..0b55f572 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ -BINARIES=bin/buildd bin/buildctl -BINARIES_EXTRA=bin/buildd.oci_only bin/buildd.containerd_only bin/buildctl-darwin bin/buildd.exe bin/buildctl.exe +BINARIES=bin/buildkitd bin/buildctl +BINARIES_EXTRA=bin/buildkitd.oci_only bin/buildkitd.containerd_only bin/buildctl-darwin bin/buildkitd.exe bin/buildctl.exe DESTDIR=/usr/local binaries: $(BINARIES) diff --git a/README.md b/README.md index 31e65e7c..dfc90770 100644 --- a/README.md +++ b/README.md @@ -34,13 +34,13 @@ Dependencies: - [containerd](https://github.com/containerd/containerd) (if you want to use containerd worker) -The following command installs `buildd` and `buildctl` to `/usr/local/bin`: +The following command installs `buildkitd` and `buildctl` to `/usr/local/bin`: ```bash $ make && sudo make install ``` -You can also use `make binaries-all` to prepare `buildd.containerd_only` and `buildd.oci_only`. +You can also use `make binaries-all` to prepare `buildkitd.containerd_only` and `buildkitd.oci_only`. `examples/buildkit*` directory contains scripts that define how to build different configurations of BuildKit and its dependencies using the `client` package. Running one of these script generates a protobuf definition of a build graph. Note that the script itself does not execute any steps of the build. @@ -70,13 +70,13 @@ Different versions of the example scripts show different ways of describing the #### Examples -##### Starting the buildd daemon: +##### Starting the buildkitd daemon: ``` -buildd --debug --root /var/lib/buildkit +buildkitd --debug --root /var/lib/buildkit ``` -The buildd daemon suppports two worker backends: OCI (runc) and containerd. +The buildkitd daemon suppports two worker backends: OCI (runc) and containerd. By default, the OCI (runc) worker is used. You can set `--oci-worker=false --containerd-worker=true` to use the containerd worker. @@ -145,7 +145,7 @@ buildctl du -v #### Running containerized buildkit -buildkit can be also used by running the `buildd` daemon inside a Docker container and accessing it remotely. The client tool `buildctl` is also available for Mac and Windows. +buildkit can be also used by running the `buildkitd` daemon inside a Docker container and accessing it remotely. The client tool `buildctl` is also available for Mac and Windows. To run daemon in a container: diff --git a/client/client.go b/client/client.go index ae0f1aa6..37c49963 100644 --- a/client/client.go +++ b/client/client.go @@ -33,7 +33,7 @@ func New(address string, opts ...ClientOpt) (*Client, error) { } conn, err := grpc.Dial(address, gopts...) if err != nil { - return nil, errors.Wrapf(err, "failed to dial %q . make sure buildd is running", address) + return nil, errors.Wrapf(err, "failed to dial %q . make sure buildkitd is running", address) } c := &Client{ conn: conn, diff --git a/cmd/buildd/debug.go b/cmd/buildkitd/debug.go similarity index 100% rename from cmd/buildd/debug.go rename to cmd/buildkitd/debug.go diff --git a/cmd/buildd/main.go b/cmd/buildkitd/main.go similarity index 98% rename from cmd/buildd/main.go rename to cmd/buildkitd/main.go index a69a89d6..ed95ad38 100644 --- a/cmd/buildd/main.go +++ b/cmd/buildkitd/main.go @@ -56,7 +56,7 @@ func registerWorkerInitializer(wi workerInitializer, flags ...cli.Flag) { func main() { app := cli.NewApp() - app.Name = "buildd" + app.Name = "buildkitd" app.Usage = "build daemon" app.Flags = []cli.Flag{ @@ -143,7 +143,7 @@ func main() { profiler.Attach(app) if err := app.Run(os.Args); err != nil { - fmt.Fprintf(os.Stderr, "buildd: %s\n", err) + fmt.Fprintf(os.Stderr, "buildkitd: %s\n", err) os.Exit(1) } } diff --git a/cmd/buildd/main_containerd_worker.go b/cmd/buildkitd/main_containerd_worker.go similarity index 100% rename from cmd/buildd/main_containerd_worker.go rename to cmd/buildkitd/main_containerd_worker.go diff --git a/cmd/buildd/main_oci_worker.go b/cmd/buildkitd/main_oci_worker.go similarity index 100% rename from cmd/buildd/main_oci_worker.go rename to cmd/buildkitd/main_oci_worker.go diff --git a/cmd/buildd/util.go b/cmd/buildkitd/util.go similarity index 100% rename from cmd/buildd/util.go rename to cmd/buildkitd/util.go diff --git a/examples/buildkit0/buildkit.go b/examples/buildkit0/buildkit.go index 2440f499..13e8cd9d 100644 --- a/examples/buildkit0/buildkit.go +++ b/examples/buildkit0/buildkit.go @@ -62,11 +62,11 @@ 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") - builddOCIWorkerOnly := src. - Run(llb.Shlex("go build -o /bin/buildd.oci_only -tags no_containerd_worker ./cmd/buildd")) + buildkitdOCIWorkerOnly := src. + Run(llb.Shlex("go build -o /bin/buildkitd.oci_only -tags no_containerd_worker ./cmd/buildkitd")) - buildd := src. - Run(llb.Shlex("go build -o /bin/buildd ./cmd/buildd")) + buildkitd := src. + Run(llb.Shlex("go build -o /bin/buildkitd ./cmd/buildkitd")) buildctl := src. Run(llb.Shlex("go build -o /bin/buildctl ./cmd/buildctl")) @@ -76,9 +76,9 @@ func buildkit(opt buildOpt) llb.State { r = copy(runc(opt.runc), "/usr/bin/runc", r, "/bin/") if opt.withContainerd { r = copy(containerd(opt.containerd), "/go/src/github.com/containerd/containerd/bin/containerd", r, "/bin/") - r = copy(buildd.Root(), "/bin/buildd", r, "/bin/") + r = copy(buildkitd.Root(), "/bin/buildkitd", r, "/bin/") } else { - r = copy(builddOCIWorkerOnly.Root(), "/bin/buildd.oci_only", r, "/bin/") + 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 b925c64f..292513db 100644 --- a/examples/buildkit1/buildkit.go +++ b/examples/buildkit1/buildkit.go @@ -57,11 +57,11 @@ func containerd(version string) llb.State { func buildkit(opt buildOpt) llb.State { src := goBuildBase().With(goFromGit("github.com/moby/buildkit", "master")) - builddOCIWorkerOnly := src. - Run(llb.Shlex("go build -o /bin/buildd.oci_only -tags no_containerd_worker ./cmd/buildd")).Root() + buildkitdOCIWorkerOnly := src. + Run(llb.Shlex("go build -o /bin/buildkitd.oci_only -tags no_containerd_worker ./cmd/buildkitd")).Root() - buildd := src. - Run(llb.Shlex("go build -o /bin/buildd ./cmd/buildd")).Root() + buildkitd := src. + Run(llb.Shlex("go build -o /bin/buildkitd ./cmd/buildkitd")).Root() buildctl := src. Run(llb.Shlex("go build -o /bin/buildctl ./cmd/buildctl")).Root() @@ -74,9 +74,9 @@ func buildkit(opt buildOpt) llb.State { if opt.withContainerd { return r.With( copyFrom(containerd(opt.containerd), "/go/src/github.com/containerd/containerd/bin/containerd", "/bin/"), - copyFrom(buildd, "/bin/buildd", "/bin/")) + copyFrom(buildkitd, "/bin/buildkitd", "/bin/")) } - return r.With(copyFrom(builddOCIWorkerOnly, "/bin/buildd.oci_only", "/bin/")) + return r.With(copyFrom(buildkitdOCIWorkerOnly, "/bin/buildkitd.oci_only", "/bin/")) } // 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 74ddaa70..b893979a 100644 --- a/examples/buildkit2/buildkit.go +++ b/examples/buildkit2/buildkit.go @@ -66,9 +66,9 @@ func containerd(version string) llb.State { func buildkit(opt buildOpt) llb.State { run := goRepo(goBuildBase(), "github.com/moby/buildkit", "master") - builddOCIWorkerOnly := run(llb.Shlex("go build -o ./bin/buildd.oci_only -tags no_containerd_worker ./cmd/buildd")) + buildkitdOCIWorkerOnly := run(llb.Shlex("go build -o ./bin/buildkitd.oci_only -tags no_containerd_worker ./cmd/buildkitd")) - buildd := run(llb.Shlex("go build -o ./bin/buildd ./cmd/buildd")) + buildkitd := run(llb.Shlex("go build -o ./bin/buildkitd ./cmd/buildkitd")) buildctl := run(llb.Shlex("go build -o ./bin/buildctl ./cmd/buildctl")) @@ -80,9 +80,9 @@ func buildkit(opt buildOpt) llb.State { if opt.withContainerd { return r.With( copyAll(containerd(opt.containerd), "/bin"), - copyAll(buildd, "/bin")) + copyAll(buildkitd, "/bin")) } - return r.With(copyAll(builddOCIWorkerOnly, "/bin")) + return r.With(copyAll(buildkitdOCIWorkerOnly, "/bin")) } func copyAll(src llb.State, destPath string) llb.StateOption { diff --git a/examples/buildkit3/buildkit.go b/examples/buildkit3/buildkit.go index b012f423..f61ec0c6 100644 --- a/examples/buildkit3/buildkit.go +++ b/examples/buildkit3/buildkit.go @@ -82,9 +82,9 @@ func buildkit(opt buildOpt) llb.State { } run := goRepo(goBuildBase(), repo, src) - builddOCIWorkerOnly := run(llb.Shlex("go build -o /out/buildd.oci_only -tags no_containerd_worker ./cmd/buildd")) + buildkitdOCIWorkerOnly := run(llb.Shlex("go build -o /out/buildkitd.oci_only -tags no_containerd_worker ./cmd/buildkitd")) - buildd := run(llb.Shlex("go build -o /out/buildd ./cmd/buildd")) + buildkitd := run(llb.Shlex("go build -o /out/buildkitd ./cmd/buildkitd")) buildctl := run(llb.Shlex("go build -o /out/buildctl ./cmd/buildctl")) @@ -96,9 +96,9 @@ func buildkit(opt buildOpt) llb.State { if opt.withContainerd { return r.With( copyAll(containerd(opt.containerd), "/"), - copyAll(buildd, "/")) + copyAll(buildkitd, "/")) } - return r.With(copyAll(builddOCIWorkerOnly, "/")) + return r.With(copyAll(buildkitdOCIWorkerOnly, "/")) } func copyAll(src llb.State, destPath string) llb.StateOption { diff --git a/examples/gobuild/main.go b/examples/gobuild/main.go index fe7669a9..bdbdcbb2 100644 --- a/examples/gobuild/main.go +++ b/examples/gobuild/main.go @@ -31,16 +31,16 @@ func run() error { return err } - buildd, err := gb.BuildExe(gobuild.BuildOpt{ + buildkitd, err := gb.BuildExe(gobuild.BuildOpt{ Source: src, MountPath: "/go/src/github.com/moby/buildkit", - Pkg: "github.com/moby/buildkit/cmd/buildd", + Pkg: "github.com/moby/buildkit/cmd/buildkitd", BuildTags: []string{"no_containerd_worker"}, }) if err != nil { return err } - _ = buildd + _ = buildkitd containerd, err := gb.BuildExe(gobuild.BuildOpt{ Source: llb.Git("github.com/containerd/containerd", "master"), @@ -65,7 +65,7 @@ func run() error { sc := llb.Scratch(). With(copyAll(*buildctl, "/")). With(copyAll(*containerd, "/")). - // With(copyAll(*buildd, "/")). + // With(copyAll(*buildkitd, "/")). With(copyAll(*runc, "/")) dt, err := sc.Marshal() diff --git a/hack/dockerfiles/test.Dockerfile b/hack/dockerfiles/test.Dockerfile index 31f4f1aa..26d10cc6 100644 --- a/hack/dockerfiles/test.Dockerfile +++ b/hack/dockerfiles/test.Dockerfile @@ -1,10 +1,10 @@ ARG RUNC_VERSION=74a17296470088de3805e138d3d87c62e613dfc4 ARG CONTAINERD_VERSION=v1.0.0 -# available targets: buildd, buildd.oci_only, buildd.containerd_only -ARG BUILDKIT_TARGET=buildd +# available targets: buildkitd, buildkitd.oci_only, buildkitd.containerd_only +ARG BUILDKIT_TARGET=buildkitd ARG REGISTRY_VERSION=2.6 -# The `buildd` stage and the `buildctl` stage are placed here +# The `buildkitd` stage and the `buildctl` stage are placed here # so that they can be built quickly with legacy DAG-unaware `docker build --target=...` FROM golang:1.9-alpine AS gobuild-base @@ -20,9 +20,9 @@ ENV CGO_ENABLED=0 ARG GOOS=linux RUN go build -ldflags '-d' -o /usr/bin/buildctl ./cmd/buildctl -FROM buildkit-base AS buildd +FROM buildkit-base AS buildkitd ENV CGO_ENABLED=0 -RUN go build -ldflags '-d' -o /usr/bin/buildd ./cmd/buildd +RUN go build -ldflags '-d' -o /usr/bin/buildkitd ./cmd/buildkitd # test dependencies begin here FROM gobuild-base AS runc @@ -47,19 +47,19 @@ COPY --from=runc /usr/bin/runc /usr/bin/runc COPY --from=containerd /go/src/github.com/containerd/containerd/bin/containerd* /usr/bin/ -FROM buildkit-base AS buildd.oci_only +FROM buildkit-base AS buildkitd.oci_only ENV CGO_ENABLED=0 -RUN go build -ldflags '-d' -o /usr/bin/buildd.oci_only -tags no_containerd_worker ./cmd/buildd +RUN go build -ldflags '-d' -o /usr/bin/buildkitd.oci_only -tags no_containerd_worker ./cmd/buildkitd -FROM buildkit-base AS buildd.containerd_only +FROM buildkit-base AS buildkitd.containerd_only ENV CGO_ENABLED=0 -RUN go build -ldflags '-d' -o /usr/bin/buildd.containerd_only -tags no_oci_worker ./cmd/buildd +RUN go build -ldflags '-d' -o /usr/bin/buildkitd.containerd_only -tags no_oci_worker ./cmd/buildkitd FROM registry:$REGISTRY_VERSION AS registry FROM unit-tests AS integration-tests COPY --from=buildctl /usr/bin/buildctl /usr/bin/ -COPY --from=buildd /usr/bin/buildd /usr/bin +COPY --from=buildkitd /usr/bin/buildkitd /usr/bin COPY --from=registry /bin/registry /usr/bin FROM gobuild-base AS cross-windows @@ -70,32 +70,32 @@ COPY . . FROM cross-windows AS buildctl.exe RUN go build -o /buildctl.exe ./cmd/buildctl -FROM cross-windows AS buildd.exe -RUN go build -o /buildd.exe ./cmd/buildd +FROM cross-windows AS buildkitd.exe +RUN go build -o /buildkitd.exe ./cmd/buildkitd FROM alpine AS buildkit-export RUN apk add --no-cache git VOLUME /var/lib/buildkit # Copy together all binaries for oci+containerd mode -FROM buildkit-export AS buildkit-buildd +FROM buildkit-export AS buildkit-buildkitd COPY --from=runc /usr/bin/runc /usr/bin/ -COPY --from=buildd /usr/bin/buildd /usr/bin/ +COPY --from=buildkitd /usr/bin/buildkitd /usr/bin/ COPY --from=buildctl /usr/bin/buildctl /usr/bin/ -ENTRYPOINT ["buildd"] +ENTRYPOINT ["buildkitd"] # Copy together all binaries needed for oci worker mode -FROM buildkit-export AS buildkit-buildd.oci_only -COPY --from=buildd.oci_only /usr/bin/buildd.oci_only /usr/bin/ +FROM buildkit-export AS buildkit-buildkitd.oci_only +COPY --from=buildkitd.oci_only /usr/bin/buildkitd.oci_only /usr/bin/ COPY --from=buildctl /usr/bin/buildctl /usr/bin/ -ENTRYPOINT ["buildd.oci_only"] +ENTRYPOINT ["buildkitd.oci_only"] # Copy together all binaries for containerd worker mode -FROM buildkit-export AS buildkit-buildd.containerd_only +FROM buildkit-export AS buildkit-buildkitd.containerd_only COPY --from=runc /usr/bin/runc /usr/bin/ -COPY --from=buildd.containerd_only /usr/bin/buildd.containerd_only /usr/bin/ +COPY --from=buildkitd.containerd_only /usr/bin/buildkitd.containerd_only /usr/bin/ COPY --from=buildctl /usr/bin/buildctl /usr/bin/ -ENTRYPOINT ["buildd.containerd_only"] +ENTRYPOINT ["buildkitd.containerd_only"] FROM alpine AS containerd-runtime COPY --from=runc /usr/bin/runc /usr/bin/ diff --git a/util/appdefaults/appdefaults_unix.go b/util/appdefaults/appdefaults_unix.go index 6cf8e300..4cc1b454 100644 --- a/util/appdefaults/appdefaults_unix.go +++ b/util/appdefaults/appdefaults_unix.go @@ -3,6 +3,6 @@ package appdefaults const ( - Address = "unix:///run/buildkit/buildd.sock" + Address = "unix:///run/buildkit/buildkitd.sock" Root = "/var/lib/buildkit" ) diff --git a/util/appdefaults/appdefaults_windows.go b/util/appdefaults/appdefaults_windows.go index 0def2041..37203ccd 100644 --- a/util/appdefaults/appdefaults_windows.go +++ b/util/appdefaults/appdefaults_windows.go @@ -1,6 +1,6 @@ package appdefaults const ( - Address = "npipe:////./pipe/buildd" + Address = "npipe:////./pipe/buildkitd" Root = ".buildstate" ) diff --git a/util/testutil/integration/containerd.go b/util/testutil/integration/containerd.go index 799758b2..06b146de 100644 --- a/util/testutil/integration/containerd.go +++ b/util/testutil/integration/containerd.go @@ -24,7 +24,7 @@ func (c *containerd) New() (sb Sandbox, cl func() error, err error) { if err := lookupBinary("containerd"); err != nil { return nil, nil, err } - if err := lookupBinary("buildd"); err != nil { + if err := lookupBinary("buildkitd"); err != nil { return nil, nil, err } if err := requireRoot(); err != nil { @@ -64,7 +64,7 @@ func (c *containerd) New() (sb Sandbox, cl func() error, err error) { return nil, nil, err } - builddSock, stop, err := runBuildd([]string{"buildd", + buildkitdSock, stop, err := runBuildkitd([]string{"buildkitd", "--oci-worker=false", "--containerd-worker=true", "--containerd-worker-addr", address}, logs) @@ -73,7 +73,7 @@ func (c *containerd) New() (sb Sandbox, cl func() error, err error) { } deferF.append(stop) - return &cdsandbox{address: address, sandbox: sandbox{address: builddSock, logs: logs, cleanup: deferF}}, cl, nil + return &cdsandbox{address: address, sandbox: sandbox{address: buildkitdSock, logs: logs, cleanup: deferF}}, cl, nil } type cdsandbox struct { diff --git a/util/testutil/integration/oci.go b/util/testutil/integration/oci.go index 83e86298..12a601c9 100644 --- a/util/testutil/integration/oci.go +++ b/util/testutil/integration/oci.go @@ -26,14 +26,14 @@ func (s *oci) Name() string { } func (s *oci) New() (Sandbox, func() error, error) { - if err := lookupBinary("buildd"); err != nil { + if err := lookupBinary("buildkitd"); err != nil { return nil, nil, err } if err := requireRoot(); err != nil { return nil, nil, err } logs := map[string]*bytes.Buffer{} - builddSock, stop, err := runBuildd([]string{"buildd", "--oci-worker=true", "--containerd-worker=false"}, logs) + buildkitdSock, stop, err := runBuildkitd([]string{"buildkitd", "--oci-worker=true", "--containerd-worker=false"}, logs) if err != nil { return nil, nil, err } @@ -41,7 +41,7 @@ func (s *oci) New() (Sandbox, func() error, error) { deferF := &multiCloser{} deferF.append(stop) - return &sandbox{address: builddSock, logs: logs, cleanup: deferF}, deferF.F(), nil + return &sandbox{address: buildkitdSock, logs: logs, cleanup: deferF}, deferF.F(), nil } type sandbox struct { @@ -85,7 +85,7 @@ func (sb *sandbox) Cmd(args ...string) *exec.Cmd { return cmd } -func runBuildd(args []string, logs map[string]*bytes.Buffer) (address string, cl func() error, err error) { +func runBuildkitd(args []string, logs map[string]*bytes.Buffer) (address string, cl func() error, err error) { deferF := &multiCloser{} cl = deferF.F() @@ -96,15 +96,15 @@ func runBuildd(args []string, logs map[string]*bytes.Buffer) (address string, cl } }() - tmpdir, err := ioutil.TempDir("", "bktest_buildd") + tmpdir, err := ioutil.TempDir("", "bktest_buildkitd") if err != nil { return "", nil, err } deferF.append(func() error { return os.RemoveAll(tmpdir) }) - address = "unix://" + filepath.Join(tmpdir, "buildd.sock") + address = "unix://" + filepath.Join(tmpdir, "buildkitd.sock") if runtime.GOOS == "windows" { - address = "//./pipe/buildd-" + filepath.Base(tmpdir) + address = "//./pipe/buildkitd-" + filepath.Base(tmpdir) } args = append(args, "--root", tmpdir, "--addr", address, "--debug")