Skip to content

Commit

Permalink
Merge pull request #229 from AkihiroSuda/buildkitd
Browse files Browse the repository at this point in the history
*: buildd -> buildkitd
  • Loading branch information
Vincent Demeester authored Dec 19, 2017
2 parents ff9d77a + 2f2b729 commit 621596d
Show file tree
Hide file tree
Showing 18 changed files with 68 additions and 68 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions cmd/buildd/main.go → cmd/buildkitd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down Expand Up @@ -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)
}
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
12 changes: 6 additions & 6 deletions examples/buildkit0/buildkit.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand All @@ -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
}
Expand Down
12 changes: 6 additions & 6 deletions examples/buildkit1/buildkit.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions examples/buildkit2/buildkit.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"))

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

Expand All @@ -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 {
Expand Down
8 changes: 4 additions & 4 deletions examples/gobuild/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand All @@ -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()
Expand Down
42 changes: 21 additions & 21 deletions hack/dockerfiles/test.Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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/
Expand Down
2 changes: 1 addition & 1 deletion util/appdefaults/appdefaults_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
package appdefaults

const (
Address = "unix:///run/buildkit/buildd.sock"
Address = "unix:///run/buildkit/buildkitd.sock"
Root = "/var/lib/buildkit"
)
2 changes: 1 addition & 1 deletion util/appdefaults/appdefaults_windows.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package appdefaults

const (
Address = "npipe:////./pipe/buildd"
Address = "npipe:////./pipe/buildkitd"
Root = ".buildstate"
)
6 changes: 3 additions & 3 deletions util/testutil/integration/containerd.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
Expand All @@ -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 {
Expand Down
Loading

0 comments on commit 621596d

Please sign in to comment.