Merge pull request #2886 from thaJeztah/bump_buildkit

vendor: BuildKit v0.8.1, Engine v20.10.1
This commit is contained in:
Tibor Vass 2020-12-22 09:32:20 -08:00 committed by GitHub
commit 2291f610ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 64 additions and 37 deletions

View File

@ -14,7 +14,7 @@ github.com/creack/pty 2a38352e8b4d7ab6c336eef107e4
github.com/davecgh/go-spew 8991bc29aa16c548c550c7ff78260e27b9ab7c73 # v1.1.1 github.com/davecgh/go-spew 8991bc29aa16c548c550c7ff78260e27b9ab7c73 # v1.1.1
github.com/docker/compose-on-kubernetes 78e6a00beda64ac8ccb9fec787e601fe2ce0d5bb # v0.5.0-alpha1 github.com/docker/compose-on-kubernetes 78e6a00beda64ac8ccb9fec787e601fe2ce0d5bb # v0.5.0-alpha1
github.com/docker/distribution 0d3efadf0154c2b8a4e7b6621fff9809655cc580 github.com/docker/distribution 0d3efadf0154c2b8a4e7b6621fff9809655cc580
github.com/docker/docker cf31b9622ae9de4b5fb7a1c9456460980ab80281 # master (v20.10.0-dev) github.com/docker/docker f0014860c1b3345e1fcc7ed81c491298de2633fb # v20.10.1
github.com/docker/docker-credential-helpers 54f0238b6bf101fc3ad3b34114cb5520beb562f5 # v0.6.3 github.com/docker/docker-credential-helpers 54f0238b6bf101fc3ad3b34114cb5520beb562f5 # v0.6.3
github.com/docker/go d30aec9fd63c35133f8f79c3412ad91a3b08be06 # Contains a customized version of canonical/json and is used by Notary. The package is periodically rebased on current Go versions. github.com/docker/go d30aec9fd63c35133f8f79c3412ad91a3b08be06 # Contains a customized version of canonical/json and is used by Notary. The package is periodically rebased on current Go versions.
github.com/docker/go-connections 7395e3f8aa162843a74ed6d48e79627d9792ac55 # v0.4.0 github.com/docker/go-connections 7395e3f8aa162843a74ed6d48e79627d9792ac55 # v0.4.0
@ -48,7 +48,7 @@ github.com/Microsoft/go-winio 5b44b70ab3ab4d291a7c1d28afe7
github.com/Microsoft/hcsshim 5bc557dd210ff2caf615e6e22d398123de77fc11 # v0.8.9 github.com/Microsoft/hcsshim 5bc557dd210ff2caf615e6e22d398123de77fc11 # v0.8.9
github.com/miekg/pkcs11 210dc1e16747c5ba98a03bcbcf728c38086ea357 # v1.0.3 github.com/miekg/pkcs11 210dc1e16747c5ba98a03bcbcf728c38086ea357 # v1.0.3
github.com/mitchellh/mapstructure d16e9488127408e67948eb43b6d3fbb9f222da10 # v1.3.2 github.com/mitchellh/mapstructure d16e9488127408e67948eb43b6d3fbb9f222da10 # v1.3.2
github.com/moby/buildkit 73fe4736135645a342abc7b587bba0994cccf0f9 # v0.8.0 github.com/moby/buildkit 8142d66b5ebde79846b869fba30d9d30633e74aa # v0.8.1
github.com/moby/sys 1bc8673b57550ddf85262eb0fed0aac651a37dab # symlink/v0.1.0 (latest tag, either mount/vXXX, mountinfo/vXXX or symlink/vXXX) github.com/moby/sys 1bc8673b57550ddf85262eb0fed0aac651a37dab # symlink/v0.1.0 (latest tag, either mount/vXXX, mountinfo/vXXX or symlink/vXXX)
github.com/moby/term bea5bbe245bf407372d477f1361d2ff042d2f556 github.com/moby/term bea5bbe245bf407372d477f1361d2ff042d2f556
github.com/modern-go/concurrent bacd9c7ef1dd9b15be4a9909b8ac7a4e313eec94 # 1.0.3 github.com/modern-go/concurrent bacd9c7ef1dd9b15be4a9909b8ac7a4e313eec94 # 1.0.3

View File

@ -33,7 +33,7 @@ github.com/imdario/mergo 1afb36080aec31e0d1528973ebe6
golang.org/x/sync cd5d95a43a6e21273425c7ae415d3df9ea832eeb golang.org/x/sync cd5d95a43a6e21273425c7ae415d3df9ea832eeb
# buildkit # buildkit
github.com/moby/buildkit 950603da215ae03b843f3f66fbe86c4876a6f5a1 github.com/moby/buildkit 8142d66b5ebde79846b869fba30d9d30633e74aa # v0.8.1
github.com/tonistiigi/fsutil 0834f99b7b85462efb69b4f571a4fa3ca7da5ac9 github.com/tonistiigi/fsutil 0834f99b7b85462efb69b4f571a4fa3ca7da5ac9
github.com/tonistiigi/units 6950e57a87eaf136bbe44ef2ec8e75b9e3569de2 github.com/tonistiigi/units 6950e57a87eaf136bbe44ef2ec8e75b9e3569de2
github.com/grpc-ecosystem/grpc-opentracing 8e809c8a86450a29b90dcc9efbf062d0fe6d9746 github.com/grpc-ecosystem/grpc-opentracing 8e809c8a86450a29b90dcc9efbf062d0fe6d9746
@ -47,7 +47,7 @@ github.com/grpc-ecosystem/go-grpc-middleware 3c51f7f332123e8be5a157c0802a
# libnetwork # libnetwork
# When updating, also update LIBNETWORK_COMMIT in hack/dockerfile/install/proxy.installer accordingly # When updating, also update LIBNETWORK_COMMIT in hack/dockerfile/install/proxy.installer accordingly
github.com/docker/libnetwork a543cbc4871f904b0efe205708eb45d72e65fd8b github.com/docker/libnetwork 5c6a95bfb20c61571a00f913c6b91959ede84e8d
github.com/docker/go-events e31b211e4f1cd09aa76fe4ac244571fab96ae47f github.com/docker/go-events e31b211e4f1cd09aa76fe4ac244571fab96ae47f
github.com/armon/go-radix e39d623f12e8e41c7b5529e9a9dd67a1e2261f80 github.com/armon/go-radix e39d623f12e8e41c7b5529e9a9dd67a1e2261f80
github.com/armon/go-metrics eb0af217e5e9747e41dd5303755356b62d28e3ec github.com/armon/go-metrics eb0af217e5e9747e41dd5303755356b62d28e3ec

View File

@ -3,7 +3,7 @@
# BuildKit # BuildKit
[![GoDoc](https://godoc.org/github.com/moby/buildkit?status.svg)](https://godoc.org/github.com/moby/buildkit/client/llb) [![GoDoc](https://godoc.org/github.com/moby/buildkit?status.svg)](https://godoc.org/github.com/moby/buildkit/client/llb)
[![Build Status](https://travis-ci.com/moby/buildkit.svg?branch=master)](https://travis-ci.com/moby/buildkit) [![Build Status](https://github.com/moby/buildkit/workflows/build/badge.svg)](https://github.com/moby/buildkit/actions?query=workflow%3Abuild)
[![Go Report Card](https://goreportcard.com/badge/github.com/moby/buildkit)](https://goreportcard.com/report/github.com/moby/buildkit) [![Go Report Card](https://goreportcard.com/badge/github.com/moby/buildkit)](https://goreportcard.com/report/github.com/moby/buildkit)
[![codecov](https://codecov.io/gh/moby/buildkit/branch/master/graph/badge.svg)](https://codecov.io/gh/moby/buildkit) [![codecov](https://codecov.io/gh/moby/buildkit/branch/master/graph/badge.svg)](https://codecov.io/gh/moby/buildkit)
@ -28,7 +28,7 @@ Introductory blog post https://blog.mobyproject.org/introducing-buildkit-17e056c
Join `#buildkit` channel on [Docker Community Slack](http://dockr.ly/slack) Join `#buildkit` channel on [Docker Community Slack](http://dockr.ly/slack)
:information_source: If you are visiting this repo for the usage of experimental Dockerfile features like `RUN --mount=type=(bind|cache|tmpfs|secret|ssh)`, please refer to [`frontend/dockerfile/docs/experimental.md`](frontend/dockerfile/docs/experimental.md). :information_source: If you are visiting this repo for the usage of BuildKit-only Dockerfile features like `RUN --mount=type=(bind|cache|tmpfs|secret|ssh)`, please refer to [`frontend/dockerfile/docs/syntax.md`](frontend/dockerfile/docs/syntax.md).
:information_source: [BuildKit has been integrated to `docker build` since Docker 18.06 .](https://docs.docker.com/develop/develop-images/build_enhancements/) :information_source: [BuildKit has been integrated to `docker build` since Docker 18.06 .](https://docs.docker.com/develop/develop-images/build_enhancements/)
You don't need to read this document unless you want to use the full-featured standalone version of BuildKit. You don't need to read this document unless you want to use the full-featured standalone version of BuildKit.
@ -178,7 +178,7 @@ buildctl build \
#### Building a Dockerfile using external frontend: #### Building a Dockerfile using external frontend:
External versions of the Dockerfile frontend are pushed to https://hub.docker.com/r/docker/dockerfile-upstream and https://hub.docker.com/r/docker/dockerfile and can be used with the gateway frontend. The source for the external frontend is currently located in `./frontend/dockerfile/cmd/dockerfile-frontend` but will move out of this repository in the future ([#163](https://github.com/moby/buildkit/issues/163)). For automatic build from master branch of this repository `docker/dockerfile-upsteam:master` or `docker/dockerfile-upstream:master-experimental` image can be used. External versions of the Dockerfile frontend are pushed to https://hub.docker.com/r/docker/dockerfile-upstream and https://hub.docker.com/r/docker/dockerfile and can be used with the gateway frontend. The source for the external frontend is currently located in `./frontend/dockerfile/cmd/dockerfile-frontend` but will move out of this repository in the future ([#163](https://github.com/moby/buildkit/issues/163)). For automatic build from master branch of this repository `docker/dockerfile-upstream:master` or `docker/dockerfile-upstream:master-labs` image can be used.
```bash ```bash
buildctl build \ buildctl build \
@ -435,7 +435,7 @@ For Kubernetes deployments, see [`examples/kubernetes`](./examples/kubernetes).
### Daemonless ### Daemonless
To run client and an ephemeral daemon in a single container ("daemonless mode"): To run the client and an ephemeral daemon in a single container ("daemonless mode"):
```bash ```bash
docker run \ docker run \

View File

@ -661,6 +661,14 @@ func (f *FileOp) Marshal(ctx context.Context, c *Constraints) (digest.Digest, []
pfo := &pb.FileOp{} pfo := &pb.FileOp{}
if f.constraints.Platform == nil {
p, err := getPlatform(*f.action.state)(ctx)
if err != nil {
return "", nil, nil, nil, err
}
f.constraints.Platform = p
}
pop, md := MarshalConstraints(c, &f.constraints) pop, md := MarshalConstraints(c, &f.constraints)
pop.Op = &pb.Op_File{ pop.Op = &pb.Op_File{
File: pfo, File: pfo,

View File

@ -5,7 +5,6 @@ import (
_ "crypto/sha256" // for opencontainers/go-digest _ "crypto/sha256" // for opencontainers/go-digest
"encoding/json" "encoding/json"
"os" "os"
"regexp"
"strconv" "strconv"
"strings" "strings"
@ -207,8 +206,6 @@ const (
gitProtocolUnknown gitProtocolUnknown
) )
var gitSSHRegex = regexp.MustCompile("^([a-z0-9]+@)?[^:]+:.*$")
func getGitProtocol(remote string) (string, int) { func getGitProtocol(remote string) (string, int) {
prefixes := map[string]int{ prefixes := map[string]int{
"http://": gitProtocolHTTP, "http://": gitProtocolHTTP,
@ -224,7 +221,7 @@ func getGitProtocol(remote string) (string, int) {
} }
} }
if protocolType == gitProtocolUnknown && gitSSHRegex.MatchString(remote) { if protocolType == gitProtocolUnknown && sshutil.IsSSHTransport(remote) {
protocolType = gitProtocolSSH protocolType = gitProtocolSSH
} }
@ -254,6 +251,9 @@ func Git(remote, ref string, opts ...GitOption) State {
remote = parts[0] + "/" + parts[1] remote = parts[0] + "/" + parts[1]
} }
} }
if protocolType == gitProtocolUnknown {
url = "https://" + url
}
id := remote id := remote

View File

@ -130,7 +130,11 @@ func (c *call) wait(ctx context.Context) (v interface{}, err error) {
c.mu.Lock() c.mu.Lock()
// detect case where caller has just returned, let it clean up before // detect case where caller has just returned, let it clean up before
select { select {
case <-c.ready: // could return if no error case <-c.ready:
c.mu.Unlock()
<-c.cleaned
return nil, errRetry
case <-c.ctx.done: // could return if no error
c.mu.Unlock() c.mu.Unlock()
<-c.cleaned <-c.cleaned
return nil, errRetry return nil, errRetry
@ -141,6 +145,10 @@ func (c *call) wait(ctx context.Context) (v interface{}, err error) {
if ok { if ok {
c.progressState.add(pw) c.progressState.add(pw)
} }
ctx, cancel := context.WithCancel(ctx)
defer cancel()
c.ctxs = append(c.ctxs, ctx) c.ctxs = append(c.ctxs, ctx)
c.mu.Unlock() c.mu.Unlock()
@ -149,18 +157,16 @@ func (c *call) wait(ctx context.Context) (v interface{}, err error) {
select { select {
case <-ctx.Done(): case <-ctx.Done():
select { if c.ctx.checkDone() {
case <-c.ctx.Done():
// if this cancelled the last context, then wait for function to shut down // if this cancelled the last context, then wait for function to shut down
// and don't accept any more callers // and don't accept any more callers
<-c.ready <-c.ready
return c.result, c.err return c.result, c.err
default:
if ok {
c.progressState.close(pw)
}
return nil, ctx.Err()
} }
if ok {
c.progressState.close(pw)
}
return nil, ctx.Err()
case <-c.ready: case <-c.ready:
return c.result, c.err // shared not implemented yet return c.result, c.err // shared not implemented yet
} }
@ -183,9 +189,6 @@ func (c *call) Deadline() (deadline time.Time, ok bool) {
} }
func (c *call) Done() <-chan struct{} { func (c *call) Done() <-chan struct{} {
c.mu.Lock()
c.ctx.signal()
c.mu.Unlock()
return c.ctx.done return c.ctx.done
} }
@ -238,23 +241,28 @@ func newContext(c *call) *sharedContext {
return &sharedContext{call: c, done: make(chan struct{})} return &sharedContext{call: c, done: make(chan struct{})}
} }
// call with lock func (sc *sharedContext) checkDone() bool {
func (c *sharedContext) signal() { sc.mu.Lock()
select { select {
case <-c.done: case <-sc.done:
sc.mu.Unlock()
return true
default: default:
var err error
for _, ctx := range c.ctxs {
select {
case <-ctx.Done():
err = ctx.Err()
default:
return
}
}
c.err = err
close(c.done)
} }
var err error
for _, ctx := range sc.ctxs {
select {
case <-ctx.Done():
err = ctx.Err()
default:
sc.mu.Unlock()
return false
}
}
sc.err = err
close(sc.done)
sc.mu.Unlock()
return true
} }
type rawProgressWriter interface { type rawProgressWriter interface {

View File

@ -0,0 +1,11 @@
package sshutil
import (
"regexp"
)
var gitSSHRegex = regexp.MustCompile("^[a-zA-Z0-9-_]+@[a-zA-Z0-9-.]+:.*$")
func IsSSHTransport(s string) bool {
return gitSSHRegex.MatchString(s)
}