mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-10 05:27:07 +08:00
vendor: update buildkit to f238f1e
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
15
vendor/github.com/moby/buildkit/session/auth/authprovider/authprovider.go
generated
vendored
15
vendor/github.com/moby/buildkit/session/auth/authprovider/authprovider.go
generated
vendored
@ -2,7 +2,8 @@ package authprovider
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"sync"
|
||||
|
||||
"github.com/docker/cli/cli/config"
|
||||
"github.com/docker/cli/cli/config/configfile"
|
||||
@ -11,14 +12,20 @@ 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),
|
||||
}
|
||||
}
|
||||
|
||||
type authProvider struct {
|
||||
config *configfile.ConfigFile
|
||||
|
||||
// The need for this mutex is not well understood.
|
||||
// Without it, the docker cli on OS X hangs when
|
||||
// reading credentials from docker-credential-osxkeychain.
|
||||
// See issue https://github.com/docker/cli/issues/1862
|
||||
mu sync.Mutex
|
||||
}
|
||||
|
||||
func (ap *authProvider) Register(server *grpc.Server) {
|
||||
@ -26,6 +33,8 @@ func (ap *authProvider) Register(server *grpc.Server) {
|
||||
}
|
||||
|
||||
func (ap *authProvider) Credentials(ctx context.Context, req *auth.CredentialsRequest) (*auth.CredentialsResponse, error) {
|
||||
ap.mu.Lock()
|
||||
defer ap.mu.Unlock()
|
||||
if req.Host == "registry-1.docker.io" {
|
||||
req.Host = "https://index.docker.io/v1/"
|
||||
}
|
||||
|
6
vendor/github.com/moby/buildkit/session/grpchijack/dial.go
generated
vendored
6
vendor/github.com/moby/buildkit/session/grpchijack/dial.go
generated
vendored
@ -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
|
||||
|
2
vendor/github.com/moby/buildkit/session/manager.go
generated
vendored
2
vendor/github.com/moby/buildkit/session/manager.go
generated
vendored
@ -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()
|
||||
}
|
||||
}()
|
||||
|
||||
|
Reference in New Issue
Block a user