Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove containerizedengine package dependency from docker/cli/command… #1361

Merged
merged 1 commit into from
Sep 11, 2018

Conversation

vdemeester
Copy link
Collaborator

@vdemeester vdemeester commented Sep 11, 2018

… this removes a whole lot of dependencies from people depending on docker/cli…

We should not leak internal/containerizedcontainer (and its dependencies) for users/projects that depend on docker/cli.

PS: I really think it should be backported to 18.03 too 👼

Signed-off-by: Vincent Demeester [email protected]

@codecov-io
Copy link

codecov-io commented Sep 11, 2018

Codecov Report

❗ No coverage uploaded for pull request base (master@11ef349). Click here to learn what that means.
The diff coverage is 65.21%.

@@            Coverage Diff            @@
##             master    #1361   +/-   ##
=========================================
  Coverage          ?   54.62%           
=========================================
  Files             ?      293           
  Lines             ?    19371           
  Branches          ?        0           
=========================================
  Hits              ?    10581           
  Misses            ?     8130           
  Partials          ?      660

@@ -0,0 +1,73 @@
package command
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This probably should go elsewhere, something like cli/types or something, not sure though…

@vdemeester vdemeester force-pushed the contains-containerized branch 3 times, most recently from 5ff978a to a5d66c8 Compare September 11, 2018 10:36
@@ -252,8 +252,8 @@ type ClientInfo struct {
}

// NewDockerCli returns a DockerCli instance with IO output and error streams set by in, out and err.
func NewDockerCli(in io.ReadCloser, out, err io.Writer, isTrusted bool) *DockerCli {
return &DockerCli{in: NewInStream(in), out: NewOutStream(out), err: err, contentTrust: isTrusted}
func NewDockerCli(in io.ReadCloser, out, err io.Writer, isTrusted bool, containerizedFn func(string) (ContainerizedClient, error)) *DockerCli {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be refactor with a config and some functionnal argument too

Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

left one nit

@@ -4,13 +4,14 @@ import (
"fmt"
"testing"

"github.com/docker/cli/internal/containerizedengine"
"github.com/docker/cli/cli/command"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stray blank line

@@ -26,7 +26,7 @@ func TestClientDebugEnabled(t *testing.T) {

func TestExitStatusForInvalidSubcommandWithHelpFlag(t *testing.T) {
discard := ioutil.Discard
cmd := newDockerCommand(command.NewDockerCli(os.Stdin, discard, discard, false))
cmd := newDockerCommand(command.NewDockerCli(os.Stdin, discard, discard, false, nil))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, we definitely need a struct or functional arguments 😄

@vdemeester vdemeester force-pushed the contains-containerized branch 2 times, most recently from c2c3e8c to 68e0c6b Compare September 11, 2018 12:37
… this removes a whole lot of dependencies from people depending on docker/cli…

Signed-off-by: Vincent Demeester <[email protected]>
serverInfo ServerInfo
clientInfo ClientInfo
contentTrust bool
newContainerizeClient func(string) (clitypes.ContainerizedClient, error)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a fan of this trick...

Copy link
Contributor

@silvin-lubecki silvin-lubecki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but I think a follow up could clean the new newContainerizeClient field in the DockerCli struct. And find another name for the new package, because cli/types ... 😄

@silvin-lubecki silvin-lubecki merged commit 2eb9b0c into docker:master Sep 11, 2018
@silvin-lubecki silvin-lubecki deleted the contains-containerized branch September 11, 2018 13:54
@GordonTheTurtle GordonTheTurtle added this to the 18.09.0 milestone Sep 11, 2018
@thaJeztah thaJeztah modified the milestones: 18.09.0, 19.03.0 Sep 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants