-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Remove containerizedengine package dependency from docker/cli/command… #1361
Conversation
016decd
to
0d84fea
Compare
Codecov Report
@@ Coverage Diff @@
## master #1361 +/- ##
=========================================
Coverage ? 54.62%
=========================================
Files ? 293
Lines ? 19371
Branches ? 0
=========================================
Hits ? 10581
Misses ? 8130
Partials ? 660 |
cli/command/containerized.go
Outdated
@@ -0,0 +1,73 @@ | |||
package command |
There was a problem hiding this comment.
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…
5ff978a
to
a5d66c8
Compare
cli/command/cli.go
Outdated
@@ -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 { |
There was a problem hiding this comment.
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
There was a problem hiding this 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
cli/command/engine/rm_test.go
Outdated
@@ -4,13 +4,14 @@ import ( | |||
"fmt" | |||
"testing" | |||
|
|||
"github.com/docker/cli/internal/containerizedengine" | |||
"github.com/docker/cli/cli/command" | |||
|
There was a problem hiding this comment.
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)) |
There was a problem hiding this comment.
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 😄
c2c3e8c
to
68e0c6b
Compare
… this removes a whole lot of dependencies from people depending on docker/cli… Signed-off-by: Vincent Demeester <[email protected]>
68e0c6b
to
2d344b2
Compare
serverInfo ServerInfo | ||
clientInfo ClientInfo | ||
contentTrust bool | ||
newContainerizeClient func(string) (clitypes.ContainerizedClient, error) |
There was a problem hiding this comment.
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...
There was a problem hiding this 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
... 😄
… 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 ondocker/cli
.PS: I really think it should be backported to 18.03 too 👼
Signed-off-by: Vincent Demeester [email protected]