Fixes for updated dependencies

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2017-09-29 14:18:19 +02:00
parent 98dbfeee76
commit 0082310aa5
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C
7 changed files with 72 additions and 55 deletions

View File

@ -113,7 +113,7 @@ func resolveLocalPath(localPath string) (absPath string, err error) {
return return
} }
return archive.PreserveTrailingDotOrSeparator(absPath, localPath), nil return archive.PreserveTrailingDotOrSeparator(absPath, localPath, filepath.Separator), nil
} }
func copyFromContainer(ctx context.Context, dockerCli *command.DockerCli, srcContainer, srcPath, dstPath string, cpParam *cpConfig) (err error) { func copyFromContainer(ctx context.Context, dockerCli *command.DockerCli, srcContainer, srcPath, dstPath string, cpParam *cpConfig) (err error) {

View File

@ -10,7 +10,6 @@ import (
"github.com/docker/cli/opts" "github.com/docker/cli/opts"
"github.com/docker/docker/api/types" "github.com/docker/docker/api/types"
apiclient "github.com/docker/docker/client" apiclient "github.com/docker/docker/client"
"github.com/docker/docker/pkg/promise"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -106,7 +105,6 @@ func interactiveExec(ctx context.Context, dockerCli command.Cli, execConfig *typ
var ( var (
out, stderr io.Writer out, stderr io.Writer
in io.ReadCloser in io.ReadCloser
errCh chan error
) )
if execConfig.AttachStdin { if execConfig.AttachStdin {
@ -129,7 +127,12 @@ func interactiveExec(ctx context.Context, dockerCli command.Cli, execConfig *typ
return err return err
} }
defer resp.Close() defer resp.Close()
errCh = promise.Go(func() error {
errCh := make(chan error, 1)
go func() {
defer close(errCh)
errCh <- func() error {
streamer := hijackedIOStreamer{ streamer := hijackedIOStreamer{
streams: dockerCli, streams: dockerCli,
inputStream: in, inputStream: in,
@ -141,7 +144,8 @@ func interactiveExec(ctx context.Context, dockerCli command.Cli, execConfig *typ
} }
return streamer.stream(ctx) return streamer.stream(ctx)
}) }()
}()
if execConfig.Tty && dockerCli.In().IsTerminal() { if execConfig.Tty && dockerCli.In().IsTerminal() {
if err := MonitorTtySize(ctx, dockerCli, execID, true); err != nil { if err := MonitorTtySize(ctx, dockerCli, execID, true); err != nil {

View File

@ -15,7 +15,6 @@ import (
"github.com/docker/cli/opts" "github.com/docker/cli/opts"
"github.com/docker/docker/api/types" "github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/container" "github.com/docker/docker/api/types/container"
"github.com/docker/docker/pkg/promise"
"github.com/docker/docker/pkg/signal" "github.com/docker/docker/pkg/signal"
"github.com/docker/docker/pkg/term" "github.com/docker/docker/pkg/term"
"github.com/pkg/errors" "github.com/pkg/errors"
@ -291,7 +290,8 @@ func attachContainer(
return nil, errAttach return nil, errAttach
} }
*errCh = promise.Go(func() error { go func() {
*errCh <- func() error {
streamer := hijackedIOStreamer{ streamer := hijackedIOStreamer{
streams: dockerCli, streams: dockerCli,
inputStream: in, inputStream: in,
@ -306,7 +306,8 @@ func attachContainer(
return errHijack return errHijack
} }
return errAttach return errAttach
}) }()
}()
return resp.Close, nil return resp.Close, nil
} }

View File

@ -9,7 +9,6 @@ import (
"github.com/docker/cli/cli" "github.com/docker/cli/cli"
"github.com/docker/cli/cli/command" "github.com/docker/cli/cli/command"
"github.com/docker/docker/api/types" "github.com/docker/docker/api/types"
"github.com/docker/docker/pkg/promise"
"github.com/docker/docker/pkg/signal" "github.com/docker/docker/pkg/signal"
"github.com/docker/docker/pkg/term" "github.com/docker/docker/pkg/term"
"github.com/pkg/errors" "github.com/pkg/errors"
@ -103,7 +102,11 @@ func runStart(dockerCli *command.DockerCli, opts *startOptions) error {
return errAttach return errAttach
} }
defer resp.Close() defer resp.Close()
cErr := promise.Go(func() error {
cErr := make(chan error, 1)
go func() {
cErr <- func() error {
streamer := hijackedIOStreamer{ streamer := hijackedIOStreamer{
streams: dockerCli, streams: dockerCli,
inputStream: in, inputStream: in,
@ -119,7 +122,8 @@ func runStart(dockerCli *command.DockerCli, opts *startOptions) error {
return errAttach return errAttach
} }
return errHijack return errHijack
}) }()
}()
// 3. We should open a channel for receiving status code of the container // 3. We should open a channel for receiving status code of the container
// no matter it's detached, removed on daemon side(--rm) or exit normally. // no matter it's detached, removed on daemon side(--rm) or exit normally.

View File

@ -378,13 +378,13 @@ func runBuild(dockerCli command.Cli, options buildOptions) error {
if s != nil { if s != nil {
go func() { go func() {
logrus.Debugf("running session: %v", s.UUID()) logrus.Debugf("running session: %v", s.ID())
if err := s.Run(ctx, dockerCli.Client().DialSession); err != nil { if err := s.Run(ctx, dockerCli.Client().DialSession); err != nil {
logrus.Error(err) logrus.Error(err)
cancel() // cancel progress context cancel() // cancel progress context
} }
}() }()
buildOptions.SessionID = s.UUID() buildOptions.SessionID = s.ID()
} }
response, err := dockerCli.Client().ImageBuild(ctx, body, buildOptions) response, err := dockerCli.Client().ImageBuild(ctx, body, buildOptions)

View File

@ -53,7 +53,9 @@ func addDirToSession(session *session.Session, contextDir string, progressOutput
p := &sizeProgress{out: progressOutput, action: "Streaming build context to Docker daemon"} p := &sizeProgress{out: progressOutput, action: "Streaming build context to Docker daemon"}
workdirProvider := filesync.NewFSSyncProvider(contextDir, excludes) workdirProvider := filesync.NewFSSyncProvider([]filesync.SyncedDir{
{Dir: contextDir, Excludes: excludes},
})
session.Allow(workdirProvider) session.Allow(workdirProvider)
// this will be replaced on parallel build jobs. keep the current // this will be replaced on parallel build jobs. keep the current

View File

@ -65,10 +65,12 @@ func (s pluginRegistryService) ResolveRepository(name reference.Named) (repoInfo
return return
} }
func newRegistryService() registry.Service { func newRegistryService() (registry.Service, error) {
return pluginRegistryService{ svc, err := registry.NewService(registry.ServiceOptions{V2Only: true})
Service: registry.NewService(registry.ServiceOptions{V2Only: true}), if err != nil {
return nil, err
} }
return pluginRegistryService{Service: svc}, nil
} }
func buildPullConfig(ctx context.Context, dockerCli *command.DockerCli, opts pluginOptions, cmdName string) (types.PluginInstallOptions, error) { func buildPullConfig(ctx context.Context, dockerCli *command.DockerCli, opts pluginOptions, cmdName string) (types.PluginInstallOptions, error) {
@ -96,7 +98,11 @@ func buildPullConfig(ctx context.Context, dockerCli *command.DockerCli, opts plu
} }
ctx := context.Background() ctx := context.Background()
trusted, err := image.TrustedReference(ctx, dockerCli, nt, newRegistryService()) svc, err := newRegistryService()
if err != nil {
return types.PluginInstallOptions{}, err
}
trusted, err := image.TrustedReference(ctx, dockerCli, nt, svc)
if err != nil { if err != nil {
return types.PluginInstallOptions{}, err return types.PluginInstallOptions{}, err
} }