Skip to content

Narrow dependencies of pkg/system#39873

Merged
cpuguy83 merged 1 commit into
moby:masterfrom
jonjohnsonjr:undep-graphdriver
Sep 10, 2019
Merged

Narrow dependencies of pkg/system#39873
cpuguy83 merged 1 commit into
moby:masterfrom
jonjohnsonjr:undep-graphdriver

Conversation

@jonjohnsonjr

Copy link
Copy Markdown
Contributor

CheckSystemDriveAndRemoveDriveLetter depends on pathdriver.PathDriver
unnecessarily. This depends on the minimal interface that it actually
needs, to avoid callers from unnecessarily bringing in a
containerd/continuity dependency.

Signed-off-by: Jon Johnson [email protected]

- What I did

Reduce dependencies of pkg/system/path.go

- How I did it

Define an interface locally instead of using the interface from an external package.

- How to verify it

No behavior should change.

- A picture of a cute animal (not mandatory but encouraged)

My puggle, Grace Anne:

image

@jonjohnsonjr

Copy link
Copy Markdown
Contributor Author

I'm not familiar with this repo's CI -- is this failure possibly related to my PR or expected flakiness?

[2019-09-06T03:21:45.768Z] FAIL: check_test.go:107: DockerSuite.TearDownTest
[2019-09-06T03:21:45.768Z] 
[2019-09-06T03:21:45.768Z] assertion failed: error is not nil: Error response from daemon: container 74535956a4bbd70de2531903dfeb540498e27660028524c903105df99d10abbd: driver "windowsfilter" failed to remove root filesystem: hcsshim::GetComputeSystems: Access is denied.: failed to remove 74535956a4bbd70de2531903dfeb540498e27660028524c903105df99d10abbd
[2019-09-06T03:21:45.768Z] 
[2019-09-06T03:21:45.768Z] ----------------------------------------------------------------------
[2019-09-06T03:21:45.768Z] PANIC: docker_cli_start_test.go:190: DockerSuite.TestStartReturnCorrectExitCode
[2019-09-06T03:21:45.768Z] 
[2019-09-06T03:21:45.768Z] docker_cli_start_test.go:200:
[2019-09-06T03:21:45.768Z]     c.Assert(exitCode, checker.Equals, 12, check.Commentf("out: %s", out))
[2019-09-06T03:21:45.768Z] ... obtained int = 125
[2019-09-06T03:21:45.768Z] ... expected int = 12
[2019-09-06T03:21:45.768Z] ... out: time="2019-09-06T03:21:43Z" level=error msg="error waiting for container: EOF" 
[2019-09-06T03:21:45.768Z] 
[2019-09-06T03:21:45.768Z] 
[2019-09-06T03:21:45.768Z] ... Panic: Fixture has panicked (see related PANIC)
[2019-09-06T03:21:45.768Z] 
[2019-09-06T03:21:45.768Z] ----------------------------------------------------------------------

@cpuguy83 cpuguy83 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for submitting this.
What's the driver for this PR? (no pun intended)

Comment thread pkg/system/path.go Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is an exported function, we shouldn't have an argument that is an unexported type.
Maybe something like PathVerifier? (I hate naming things).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

SGTM, pushed.

CheckSystemDriveAndRemoveDriveLetter depends on pathdriver.PathDriver
unnecessarily. This depends on the minimal interface that it actually
needs, to avoid callers from unnecessarily bringing in a
containerd/continuity dependency.

Signed-off-by: Jon Johnson <[email protected]>
@jonjohnsonjr

Copy link
Copy Markdown
Contributor Author

What's the driver for this PR?

I tried to pull in some config file handling code from https://godoc.org/github.com/docker/cli/cli/config and was a bit surprised by how many packages I ended up needing to import. See here.

I figured I'd start at the leaves and work my way up from there. The root issue is actually the github.com/docker/docker/pkg/homedir dependency, but given this comment I'm not actually confident that it's possible to fix the underlying issue. If you have any better ideas for re-organizing packages to avoid importing logrus, etc., I'm open to it.

(no pun intended)

😅

@cpuguy83

cpuguy83 commented Sep 8, 2019

Copy link
Copy Markdown
Member

Probably docker/cli should make their own package. The usage there is very simple but the dependencies it creates are huge.

@thaJeztah

Copy link
Copy Markdown
Member

@cpuguy83 PTAL

@jonjohnsonjr

Copy link
Copy Markdown
Contributor Author

Probably docker/cli should make their own package. The usage there is very simple but the dependencies it creates are huge.

Seems reasonable -- I'll see how hard it would be to inline their homedir usage. I think this PR is still reasonable to merge, since it helps untangle things a bit, but feel free to close it if you disagree.

@dmcgowan dmcgowan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

Note we can start getting rid of github.com/containerd/continuity/pathdriver completely by deprecating the LCOW build support.

@cpuguy83 cpuguy83 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@cpuguy83
cpuguy83 merged commit 415f8ec into moby:master Sep 10, 2019
@jonjohnsonjr
jonjohnsonjr deleted the undep-graphdriver branch September 10, 2019 18:42
@thaJeztah thaJeztah added this to the 20.03.0 milestone Apr 2, 2020
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.

6 participants