update vndr moby/buildkit 8818c67

Signed-off-by: Andrew Hsu <andrewhsu@docker.com>
This commit is contained in:
Andrew Hsu 2019-04-24 18:26:58 +00:00
parent e243174b30
commit c1a4fb4922
4 changed files with 94 additions and 65 deletions

View File

@ -51,7 +51,7 @@ github.com/Microsoft/go-winio 84b4ab48a50763fe7b3abcef38e5
github.com/Microsoft/hcsshim 672e52e9209d1e53718c1b6a7d68cc9272654ab5 github.com/Microsoft/hcsshim 672e52e9209d1e53718c1b6a7d68cc9272654ab5
github.com/miekg/pkcs11 6120d95c0e9576ccf4a78ba40855809dca31a9ed github.com/miekg/pkcs11 6120d95c0e9576ccf4a78ba40855809dca31a9ed
github.com/mitchellh/mapstructure f15292f7a699fcc1a38a80977f80a046874ba8ac github.com/mitchellh/mapstructure f15292f7a699fcc1a38a80977f80a046874ba8ac
github.com/moby/buildkit b3028967ae6259c9a31c1a1deeccd30fe3469cce github.com/moby/buildkit 8818c67cff663befa7b70f21454e340f71616581
github.com/modern-go/concurrent bacd9c7ef1dd9b15be4a9909b8ac7a4e313eec94 # 1.0.3 github.com/modern-go/concurrent bacd9c7ef1dd9b15be4a9909b8ac7a4e313eec94 # 1.0.3
github.com/modern-go/reflect2 4b7aa43c6742a2c18fdef89dd197aaae7dac7ccd # 1.0.1 github.com/modern-go/reflect2 4b7aa43c6742a2c18fdef89dd197aaae7dac7ccd # 1.0.1
github.com/morikuni/aec 39771216ff4c63d11f5e604076f9c45e8be1067b github.com/morikuni/aec 39771216ff4c63d11f5e604076f9c45e8be1067b

View File

@ -38,7 +38,7 @@ BuildKit is used by the following projects:
- [OpenFaaS Cloud](https://github.com/openfaas/openfaas-cloud) - [OpenFaaS Cloud](https://github.com/openfaas/openfaas-cloud)
- [container build interface](https://github.com/containerbuilding/cbi) - [container build interface](https://github.com/containerbuilding/cbi)
- [Knative Build Templates](https://github.com/knative/build-templates) - [Knative Build Templates](https://github.com/knative/build-templates)
- [boss](https://github.com/crosbymichael/boss) - [vab](https://github.com/stellarproject/vab)
- [Rio](https://github.com/rancher/rio) (on roadmap) - [Rio](https://github.com/rancher/rio) (on roadmap)
### Quick start ### Quick start
@ -100,7 +100,7 @@ To start building use `buildctl build` command. The example script accepts `--wi
go run examples/buildkit0/buildkit.go | buildctl build go run examples/buildkit0/buildkit.go | buildctl build
``` ```
`buildctl build` will show interactive progress bar by default while the build job is running. It will also show you the path to the trace file that contains all information about the timing of the individual steps and logs. `buildctl build` will show interactive progress bar by default while the build job is running. If the path to the trace file is specified, the trace file generated will contain all information about the timing of the individual steps and logs.
Different versions of the example scripts show different ways of describing the build definition for this project to show the capabilities of the library. New versions have been added when new features have become available. Different versions of the example scripts show different ways of describing the build definition for this project to show the capabilities of the library. New versions have been added when new features have become available.
@ -218,8 +218,8 @@ buildctl build ... --import-cache type=registry,ref=localhost:5000/myrepo:buildc
#### To/From local filesystem #### To/From local filesystem
``` ```
buildctl build ... --export-cache type=local,src=path/to/input-dir buildctl build ... --export-cache type=local,dest=path/to/output-dir
buildctl build ... --import-cache type=local,dest=path/to/output-dir buildctl build ... --import-cache type=local,src=path/to/input-dir
``` ```
The directory layout conforms to OCI Image Spec v1.0. The directory layout conforms to OCI Image Spec v1.0.
@ -228,11 +228,11 @@ The directory layout conforms to OCI Image Spec v1.0.
* `mode=min` (default): only export layers for the resulting image * `mode=min` (default): only export layers for the resulting image
* `mode=max`: export all the layers of all intermediate steps * `mode=max`: export all the layers of all intermediate steps
* `ref=docker.io/user/image:tag`: reference for `registry` cache exporter * `ref=docker.io/user/image:tag`: reference for `registry` cache exporter
* `src=path/to/output-dir`: directory for `local` cache exporter * `dest=path/to/output-dir`: directory for `local` cache exporter
#### `--import-cache` options #### `--import-cache` options
* `ref=docker.io/user/image:tag`: reference for `registry` cache importer * `ref=docker.io/user/image:tag`: reference for `registry` cache importer
* `dest=path/to/input-dir`: directory for `local` cache importer * `src=path/to/input-dir`: directory for `local` cache importer
* `digest=sha256:deadbeef`: digest of the manifest list to import for `local` cache importer. Defaults to the digest of "latest" tag in `index.json` * `digest=sha256:deadbeef`: digest of the manifest list to import for `local` cache importer. Defaults to the digest of "latest" tag in `index.json`
### Other ### Other
@ -271,6 +271,18 @@ buildctl build --help
The images can be also built locally using `./hack/dockerfiles/test.Dockerfile` (or `./hack/dockerfiles/test.buildkit.Dockerfile` if you already have BuildKit). The images can be also built locally using `./hack/dockerfiles/test.Dockerfile` (or `./hack/dockerfiles/test.buildkit.Dockerfile` if you already have BuildKit).
Run `make images` to build the images as `moby/buildkit:local` and `moby/buildkit:local-rootless`. Run `make images` to build the images as `moby/buildkit:local` and `moby/buildkit:local-rootless`.
#### Connection helpers
If you are running `moby/buildkit:master` or `moby/buildkit:master-rootless` as a Docker/Kubernetes container, you can use special `BUILDKIT_HOST` URL for connecting to the BuildKit daemon in the container:
```
export BUILDKIT_HOST=docker://<container>
```
```
export BUILDKIT_HOST=kube-pod://<pod>
```
### Opentracing support ### Opentracing support
BuildKit supports opentracing for buildkitd gRPC API and buildctl commands. To capture the trace to [Jaeger](https://github.com/jaegertracing/jaeger), set `JAEGER_TRACE` environment variable to the collection address. BuildKit supports opentracing for buildkitd gRPC API and buildctl commands. To capture the trace to [Jaeger](https://github.com/jaegertracing/jaeger), set `JAEGER_TRACE` environment variable to the collection address.

View File

@ -39,6 +39,8 @@ type SolveOpt struct {
CacheImports []CacheOptionsEntry CacheImports []CacheOptionsEntry
Session []session.Attachable Session []session.Attachable
AllowedEntitlements []entitlements.Entitlement AllowedEntitlements []entitlements.Entitlement
SharedSession *session.Session // TODO: refactor to better session syncing
SessionPreInitialized bool // TODO: refactor to better session syncing
} }
type ExportEntry struct { type ExportEntry struct {
@ -94,11 +96,26 @@ func (c *Client) solve(ctx context.Context, def *llb.Definition, runGateway runG
statusContext = opentracing.ContextWithSpan(statusContext, span) statusContext = opentracing.ContextWithSpan(statusContext, span)
} }
s, err := session.NewSession(statusContext, defaultSessionName(), opt.SharedKey) s := opt.SharedSession
if s == nil {
if opt.SessionPreInitialized {
return nil, errors.Errorf("no session provided for preinitialized option")
}
s, err = session.NewSession(statusContext, defaultSessionName(), opt.SharedKey)
if err != nil { if err != nil {
return nil, errors.Wrap(err, "failed to create session") return nil, errors.Wrap(err, "failed to create session")
} }
}
cacheOpt, err := parseCacheOptions(opt)
if err != nil {
return nil, err
}
var ex ExportEntry
if !opt.SessionPreInitialized {
if len(syncedDirs) > 0 { if len(syncedDirs) > 0 {
s.Allow(filesync.NewFSSyncProvider(syncedDirs)) s.Allow(filesync.NewFSSyncProvider(syncedDirs))
} }
@ -107,7 +124,6 @@ func (c *Client) solve(ctx context.Context, def *llb.Definition, runGateway runG
s.Allow(a) s.Allow(a)
} }
var ex ExportEntry
if len(opt.Exports) > 1 { if len(opt.Exports) > 1 {
return nil, errors.New("currently only single Exports can be specified") return nil, errors.New("currently only single Exports can be specified")
} }
@ -141,20 +157,18 @@ func (c *Client) solve(ctx context.Context, def *llb.Definition, runGateway runG
} }
} }
cacheOpt, err := parseCacheOptions(opt)
if err != nil {
return nil, err
}
if len(cacheOpt.contentStores) > 0 { if len(cacheOpt.contentStores) > 0 {
s.Allow(sessioncontent.NewAttachable(cacheOpt.contentStores)) s.Allow(sessioncontent.NewAttachable(cacheOpt.contentStores))
} }
for k, v := range cacheOpt.frontendAttrs {
opt.FrontendAttrs[k] = v
}
eg.Go(func() error { eg.Go(func() error {
return s.Run(statusContext, grpchijack.Dialer(c.controlClient())) return s.Run(statusContext, grpchijack.Dialer(c.controlClient()))
}) })
}
for k, v := range cacheOpt.frontendAttrs {
opt.FrontendAttrs[k] = v
}
solveCtx, cancelSolve := context.WithCancel(ctx) solveCtx, cancelSolve := context.WithCancel(ctx)
var res *SolveResponse var res *SolveResponse

View File

@ -227,7 +227,10 @@ func (t *trace) update(s *client.SolveStatus, termWidth int) {
} }
t.vertexes = append(t.vertexes, t.byDigest[v.Digest]) t.vertexes = append(t.vertexes, t.byDigest[v.Digest])
} }
// allow a duplicate initial vertex that shouldn't reset state
if !(prev != nil && prev.Started != nil && v.Started == nil) {
t.byDigest[v.Digest].Vertex = v t.byDigest[v.Digest].Vertex = v
}
t.byDigest[v.Digest].jobCached = false t.byDigest[v.Digest].jobCached = false
} }
for _, s := range s.Statuses { for _, s := range s.Statuses {