From c15fb3a8e5e5935bdc5f0039b6fb0e896c7f7f96 Mon Sep 17 00:00:00 2001 From: Tibor Vass Date: Tue, 14 May 2019 01:24:27 +0000 Subject: [PATCH] vendor buildkit to f238f1e Signed-off-by: Tibor Vass (cherry picked from commit 529ef6e89a09dae1866eda6eae22eeb7dda15270) Signed-off-by: Sebastiaan van Stijn --- cli/command/image/build_buildkit.go | 2 +- vendor.conf | 2 +- vendor/github.com/moby/buildkit/client/solve.go | 3 --- .../moby/buildkit/frontend/gateway/grpcclient/client.go | 2 ++ .../moby/buildkit/session/auth/authprovider/authprovider.go | 6 +++--- vendor/github.com/moby/buildkit/session/grpchijack/dial.go | 6 ++++++ vendor/github.com/moby/buildkit/session/manager.go | 2 ++ 7 files changed, 15 insertions(+), 8 deletions(-) diff --git a/cli/command/image/build_buildkit.go b/cli/command/image/build_buildkit.go index f9cae0ceb7..d7d02d6a49 100644 --- a/cli/command/image/build_buildkit.go +++ b/cli/command/image/build_buildkit.go @@ -174,7 +174,7 @@ func runBuildBuildKit(dockerCli command.Cli, options buildOptions) error { })) } - s.Allow(authprovider.NewDockerAuthProvider()) + s.Allow(authprovider.NewDockerAuthProvider(os.Stderr)) if len(options.secrets) > 0 { sp, err := parseSecretSpecs(options.secrets) if err != nil { diff --git a/vendor.conf b/vendor.conf index 9f4fd0a497..be7675dfbd 100755 --- a/vendor.conf +++ b/vendor.conf @@ -51,7 +51,7 @@ github.com/Microsoft/go-winio 84b4ab48a50763fe7b3abcef38e5 github.com/Microsoft/hcsshim 672e52e9209d1e53718c1b6a7d68cc9272654ab5 github.com/miekg/pkcs11 6120d95c0e9576ccf4a78ba40855809dca31a9ed github.com/mitchellh/mapstructure f15292f7a699fcc1a38a80977f80a046874ba8ac -github.com/moby/buildkit 646fc0af6d283397b9e47cd0a18779e9d0376e0e # v0.5.1 +github.com/moby/buildkit f238f1efb04f00bf0cc147141fda9ddb55c8bc49 github.com/modern-go/concurrent bacd9c7ef1dd9b15be4a9909b8ac7a4e313eec94 # 1.0.3 github.com/modern-go/reflect2 4b7aa43c6742a2c18fdef89dd197aaae7dac7ccd # 1.0.1 github.com/morikuni/aec 39771216ff4c63d11f5e604076f9c45e8be1067b diff --git a/vendor/github.com/moby/buildkit/client/solve.go b/vendor/github.com/moby/buildkit/client/solve.go index 830c018cbb..17b3810cdc 100644 --- a/vendor/github.com/moby/buildkit/client/solve.go +++ b/vendor/github.com/moby/buildkit/client/solve.go @@ -410,9 +410,6 @@ func parseCacheOptions(opt SolveOpt) (*cacheOptions, error) { if csDir == "" { return nil, errors.New("local cache importer requires src") } - if err := os.MkdirAll(csDir, 0755); err != nil { - return nil, err - } cs, err := contentlocal.NewStore(csDir) if err != nil { return nil, err diff --git a/vendor/github.com/moby/buildkit/frontend/gateway/grpcclient/client.go b/vendor/github.com/moby/buildkit/frontend/gateway/grpcclient/client.go index c9f437349c..b39b280816 100644 --- a/vendor/github.com/moby/buildkit/frontend/gateway/grpcclient/client.go +++ b/vendor/github.com/moby/buildkit/frontend/gateway/grpcclient/client.go @@ -28,6 +28,8 @@ type GrpcClient interface { } func New(ctx context.Context, opts map[string]string, session, product string, c pb.LLBBridgeClient, w []client.WorkerInfo) (GrpcClient, error) { + ctx, cancel := context.WithTimeout(ctx, 5*time.Second) + defer cancel() resp, err := c.Ping(ctx, &pb.PingRequest{}) if err != nil { return nil, err diff --git a/vendor/github.com/moby/buildkit/session/auth/authprovider/authprovider.go b/vendor/github.com/moby/buildkit/session/auth/authprovider/authprovider.go index 7df33cca4b..a7eb6f2201 100644 --- a/vendor/github.com/moby/buildkit/session/auth/authprovider/authprovider.go +++ b/vendor/github.com/moby/buildkit/session/auth/authprovider/authprovider.go @@ -2,7 +2,7 @@ package authprovider import ( "context" - "io/ioutil" + "io" "sync" "github.com/docker/cli/cli/config" @@ -12,9 +12,9 @@ import ( "google.golang.org/grpc" ) -func NewDockerAuthProvider() session.Attachable { +func NewDockerAuthProvider(stderr io.Writer) session.Attachable { return &authProvider{ - config: config.LoadDefaultConfigFile(ioutil.Discard), + config: config.LoadDefaultConfigFile(stderr), } } diff --git a/vendor/github.com/moby/buildkit/session/grpchijack/dial.go b/vendor/github.com/moby/buildkit/session/grpchijack/dial.go index 151ab5498f..2486563e33 100644 --- a/vendor/github.com/moby/buildkit/session/grpchijack/dial.go +++ b/vendor/github.com/moby/buildkit/session/grpchijack/dial.go @@ -46,6 +46,7 @@ type conn struct { closedOnce sync.Once readMu sync.Mutex + writeMu sync.Mutex err error closeCh chan struct{} } @@ -79,6 +80,8 @@ func (c *conn) Read(b []byte) (n int, err error) { } func (c *conn) Write(b []byte) (int, error) { + c.writeMu.Lock() + defer c.writeMu.Unlock() m := &controlapi.BytesMessage{Data: b} if err := c.stream.SendMsg(m); err != nil { return 0, err @@ -93,7 +96,9 @@ func (c *conn) Close() (err error) { }() if cs, ok := c.stream.(grpc.ClientStream); ok { + c.writeMu.Lock() err = cs.CloseSend() + c.writeMu.Unlock() if err != nil { return } @@ -106,6 +111,7 @@ func (c *conn) Close() (err error) { err = c.stream.RecvMsg(m) if err != nil { if err != io.EOF { + c.readMu.Unlock() return } err = nil diff --git a/vendor/github.com/moby/buildkit/session/manager.go b/vendor/github.com/moby/buildkit/session/manager.go index f401c7fb33..e01b047e23 100644 --- a/vendor/github.com/moby/buildkit/session/manager.go +++ b/vendor/github.com/moby/buildkit/session/manager.go @@ -162,7 +162,9 @@ func (sm *Manager) Get(ctx context.Context, id string) (Caller, error) { go func() { select { case <-ctx.Done(): + sm.mu.Lock() sm.updateCondition.Broadcast() + sm.mu.Unlock() } }()