Merge pull request #229 from AkihiroSuda/buildkitd

*: buildd -> buildkitd
docker-18.09
Vincent Demeester 2017-12-19 10:03:17 +01:00 committed by GitHub
commit 621596d36b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 68 additions and 68 deletions

View File

@ -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)

View File

@ -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:

View File

@ -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,

View File

@ -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)
}
}

View File

@ -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
}

View File

@ -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

View File

@ -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 {

View File

@ -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 {

View File

@ -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()

View File

@ -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/

View File

@ -3,6 +3,6 @@
package appdefaults
const (
Address = "unix:///run/buildkit/buildd.sock"
Address = "unix:///run/buildkit/buildkitd.sock"
Root = "/var/lib/buildkit"
)

View File

@ -1,6 +1,6 @@
package appdefaults
const (
Address = "npipe:////./pipe/buildd"
Address = "npipe:////./pipe/buildkitd"
Root = ".buildstate"
)

View File

@ -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 {

View File

@ -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")