directly embed the orignal APIClient in the DryRunClient

Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
This commit is contained in:
Guillaume Lours 2023-01-13 18:19:33 +01:00
parent 3fac506a30
commit fb36f7fffd
3 changed files with 108 additions and 649 deletions

View File

@ -26,6 +26,8 @@ import (
"strings"
"syscall"
"github.com/docker/cli/cli/command"
"github.com/compose-spec/compose-go/cli"
"github.com/compose-spec/compose-go/types"
composegoutils "github.com/compose-spec/compose-go/utils"
@ -243,7 +245,7 @@ func RunningAsStandalone() bool {
}
// RootCommand returns the compose command with its child commands
func RootCommand(streams api.Streams, backend api.Service) *cobra.Command { //nolint:gocyclo
func RootCommand(streams command.Cli, backend api.Service) *cobra.Command { //nolint:gocyclo
// filter out useless commandConn.CloseWrite warning message that can occur
// when using a remote context that is unreachable: "commandConn.CloseWrite: commandconn: failed to wait: signal: killed"
// https://github.com/docker/cli/blob/e1f24d3c93df6752d3c27c8d61d18260f141310c/cli/connhelper/commandconn/commandconn.go#L203-L215

File diff suppressed because it is too large Load Diff

View File

@ -73,8 +73,7 @@ func (s *composeService) DryRunMode(dryRun bool) error {
return err
}
err = cli.Initialize(flags.NewClientOptions(), command.WithInitializeClient(func(cli *command.DockerCli) (client.APIClient, error) {
dryRunClient := api.NewDryRunClient()
dryRunClient.WithAPIClient(s.apiClient())
dryRunClient := api.NewDryRunClient(s.apiClient())
return dryRunClient, nil
}))
if err != nil {