mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-09 21:17:09 +08:00
vendor: update buildkit to docker-19.03 (ae10b292)
Signed-off-by: Tibor Vass <tibor@docker.com>
This commit is contained in:
15
vendor/github.com/moby/buildkit/session/sshforward/ssh.go
generated
vendored
15
vendor/github.com/moby/buildkit/session/sshforward/ssh.go
generated
vendored
@ -7,6 +7,7 @@ import (
|
||||
"path/filepath"
|
||||
|
||||
"github.com/moby/buildkit/session"
|
||||
"github.com/pkg/errors"
|
||||
context "golang.org/x/net/context"
|
||||
"golang.org/x/sync/errgroup"
|
||||
"google.golang.org/grpc/metadata"
|
||||
@ -48,7 +49,7 @@ func (s *server) run(ctx context.Context, l net.Listener, id string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
go Copy(ctx, conn, stream)
|
||||
go Copy(ctx, conn, stream, stream.CloseSend)
|
||||
}
|
||||
})
|
||||
|
||||
@ -65,7 +66,7 @@ type SocketOpt struct {
|
||||
func MountSSHSocket(ctx context.Context, c session.Caller, opt SocketOpt) (sockPath string, closer func() error, err error) {
|
||||
dir, err := ioutil.TempDir("", ".buildkit-ssh-sock")
|
||||
if err != nil {
|
||||
return "", nil, err
|
||||
return "", nil, errors.WithStack(err)
|
||||
}
|
||||
|
||||
defer func() {
|
||||
@ -78,16 +79,16 @@ func MountSSHSocket(ctx context.Context, c session.Caller, opt SocketOpt) (sockP
|
||||
|
||||
l, err := net.Listen("unix", sockPath)
|
||||
if err != nil {
|
||||
return "", nil, err
|
||||
return "", nil, errors.WithStack(err)
|
||||
}
|
||||
|
||||
if err := os.Chown(sockPath, opt.UID, opt.GID); err != nil {
|
||||
l.Close()
|
||||
return "", nil, err
|
||||
return "", nil, errors.WithStack(err)
|
||||
}
|
||||
if err := os.Chmod(sockPath, os.FileMode(opt.Mode)); err != nil {
|
||||
l.Close()
|
||||
return "", nil, err
|
||||
return "", nil, errors.WithStack(err)
|
||||
}
|
||||
|
||||
s := &server{caller: c}
|
||||
@ -102,12 +103,12 @@ func MountSSHSocket(ctx context.Context, c session.Caller, opt SocketOpt) (sockP
|
||||
return sockPath, func() error {
|
||||
err := l.Close()
|
||||
os.RemoveAll(sockPath)
|
||||
return err
|
||||
return errors.WithStack(err)
|
||||
}, nil
|
||||
}
|
||||
|
||||
func CheckSSHID(ctx context.Context, c session.Caller, id string) error {
|
||||
client := NewSSHClient(c.Conn())
|
||||
_, err := client.CheckAgent(ctx, &CheckAgentRequest{ID: id})
|
||||
return err
|
||||
return errors.WithStack(err)
|
||||
}
|
||||
|
Reference in New Issue
Block a user