mirror of https://github.com/docker/cli.git
update vndr moby/buildkit 8818c67
Signed-off-by: Andrew Hsu <andrewhsu@docker.com>
This commit is contained in:
parent
e243174b30
commit
c1a4fb4922
|
@ -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
|
||||||
|
|
|
@ -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.
|
||||||
|
|
|
@ -30,15 +30,17 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type SolveOpt struct {
|
type SolveOpt struct {
|
||||||
Exports []ExportEntry
|
Exports []ExportEntry
|
||||||
LocalDirs map[string]string
|
LocalDirs map[string]string
|
||||||
SharedKey string
|
SharedKey string
|
||||||
Frontend string
|
Frontend string
|
||||||
FrontendAttrs map[string]string
|
FrontendAttrs map[string]string
|
||||||
CacheExports []CacheOptionsEntry
|
CacheExports []CacheOptionsEntry
|
||||||
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,50 +96,15 @@ 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 err != nil {
|
|
||||||
return nil, errors.Wrap(err, "failed to create session")
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(syncedDirs) > 0 {
|
if s == nil {
|
||||||
s.Allow(filesync.NewFSSyncProvider(syncedDirs))
|
if opt.SessionPreInitialized {
|
||||||
}
|
return nil, errors.Errorf("no session provided for preinitialized option")
|
||||||
|
|
||||||
for _, a := range opt.Session {
|
|
||||||
s.Allow(a)
|
|
||||||
}
|
|
||||||
|
|
||||||
var ex ExportEntry
|
|
||||||
if len(opt.Exports) > 1 {
|
|
||||||
return nil, errors.New("currently only single Exports can be specified")
|
|
||||||
}
|
|
||||||
if len(opt.Exports) == 1 {
|
|
||||||
ex = opt.Exports[0]
|
|
||||||
}
|
|
||||||
|
|
||||||
switch ex.Type {
|
|
||||||
case ExporterLocal:
|
|
||||||
if ex.Output != nil {
|
|
||||||
return nil, errors.New("output file writer is not supported by local exporter")
|
|
||||||
}
|
}
|
||||||
if ex.OutputDir == "" {
|
s, err = session.NewSession(statusContext, defaultSessionName(), opt.SharedKey)
|
||||||
return nil, errors.New("output directory is required for local exporter")
|
if err != nil {
|
||||||
}
|
return nil, errors.Wrap(err, "failed to create session")
|
||||||
s.Allow(filesync.NewFSSyncTargetDir(ex.OutputDir))
|
|
||||||
case ExporterOCI, ExporterDocker, ExporterTar:
|
|
||||||
if ex.OutputDir != "" {
|
|
||||||
return nil, errors.Errorf("output directory %s is not supported by %s exporter", ex.OutputDir, ex.Type)
|
|
||||||
}
|
|
||||||
if ex.Output == nil {
|
|
||||||
return nil, errors.Errorf("output file writer is required for %s exporter", ex.Type)
|
|
||||||
}
|
|
||||||
s.Allow(filesync.NewFSSyncTarget(ex.Output))
|
|
||||||
default:
|
|
||||||
if ex.Output != nil {
|
|
||||||
return nil, errors.Errorf("output file writer is not supported by %s exporter", ex.Type)
|
|
||||||
}
|
|
||||||
if ex.OutputDir != "" {
|
|
||||||
return nil, errors.Errorf("output directory %s is not supported by %s exporter", ex.OutputDir, ex.Type)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,17 +112,64 @@ func (c *Client) solve(ctx context.Context, def *llb.Definition, runGateway runG
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if len(cacheOpt.contentStores) > 0 {
|
|
||||||
s.Allow(sessioncontent.NewAttachable(cacheOpt.contentStores))
|
var ex ExportEntry
|
||||||
|
|
||||||
|
if !opt.SessionPreInitialized {
|
||||||
|
if len(syncedDirs) > 0 {
|
||||||
|
s.Allow(filesync.NewFSSyncProvider(syncedDirs))
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, a := range opt.Session {
|
||||||
|
s.Allow(a)
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(opt.Exports) > 1 {
|
||||||
|
return nil, errors.New("currently only single Exports can be specified")
|
||||||
|
}
|
||||||
|
if len(opt.Exports) == 1 {
|
||||||
|
ex = opt.Exports[0]
|
||||||
|
}
|
||||||
|
|
||||||
|
switch ex.Type {
|
||||||
|
case ExporterLocal:
|
||||||
|
if ex.Output != nil {
|
||||||
|
return nil, errors.New("output file writer is not supported by local exporter")
|
||||||
|
}
|
||||||
|
if ex.OutputDir == "" {
|
||||||
|
return nil, errors.New("output directory is required for local exporter")
|
||||||
|
}
|
||||||
|
s.Allow(filesync.NewFSSyncTargetDir(ex.OutputDir))
|
||||||
|
case ExporterOCI, ExporterDocker, ExporterTar:
|
||||||
|
if ex.OutputDir != "" {
|
||||||
|
return nil, errors.Errorf("output directory %s is not supported by %s exporter", ex.OutputDir, ex.Type)
|
||||||
|
}
|
||||||
|
if ex.Output == nil {
|
||||||
|
return nil, errors.Errorf("output file writer is required for %s exporter", ex.Type)
|
||||||
|
}
|
||||||
|
s.Allow(filesync.NewFSSyncTarget(ex.Output))
|
||||||
|
default:
|
||||||
|
if ex.Output != nil {
|
||||||
|
return nil, errors.Errorf("output file writer is not supported by %s exporter", ex.Type)
|
||||||
|
}
|
||||||
|
if ex.OutputDir != "" {
|
||||||
|
return nil, errors.Errorf("output directory %s is not supported by %s exporter", ex.OutputDir, ex.Type)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(cacheOpt.contentStores) > 0 {
|
||||||
|
s.Allow(sessioncontent.NewAttachable(cacheOpt.contentStores))
|
||||||
|
}
|
||||||
|
|
||||||
|
eg.Go(func() error {
|
||||||
|
return s.Run(statusContext, grpchijack.Dialer(c.controlClient()))
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
for k, v := range cacheOpt.frontendAttrs {
|
for k, v := range cacheOpt.frontendAttrs {
|
||||||
opt.FrontendAttrs[k] = v
|
opt.FrontendAttrs[k] = v
|
||||||
}
|
}
|
||||||
|
|
||||||
eg.Go(func() error {
|
|
||||||
return s.Run(statusContext, grpchijack.Dialer(c.controlClient()))
|
|
||||||
})
|
|
||||||
|
|
||||||
solveCtx, cancelSolve := context.WithCancel(ctx)
|
solveCtx, cancelSolve := context.WithCancel(ctx)
|
||||||
var res *SolveResponse
|
var res *SolveResponse
|
||||||
eg.Go(func() error {
|
eg.Go(func() error {
|
||||||
|
|
|
@ -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])
|
||||||
}
|
}
|
||||||
t.byDigest[v.Digest].Vertex = v
|
// 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].jobCached = false
|
t.byDigest[v.Digest].jobCached = false
|
||||||
}
|
}
|
||||||
for _, s := range s.Statuses {
|
for _, s := range s.Statuses {
|
||||||
|
|
Loading…
Reference in New Issue