Fix pruning anon volume created from image config#45147
Fix pruning anon volume created from image config#45147thaJeztah merged 1 commit intomoby:masterfrom
Conversation
594ee61 to
96aa0a9
Compare
|
Linter is failing; |
| } | ||
|
|
||
| v, err := daemon.volumes.Create(context.TODO(), name, hostConfig.VolumeDriver, volumeopts.WithCreateReference(container.ID)) | ||
| v, err := daemon.volumes.Create(context.TODO(), "", hostConfig.VolumeDriver, volumeopts.WithCreateReference(container.ID)) |
There was a problem hiding this comment.
For a follow-up; given that name is optional, we should change this signature;
- move name to options
- and/or require "anonymous" to be set as option (if we need to disambiguate "forgot to pass a name" from "must be anonymous, and generate a name for me")
moby/volume/service/service.go
Lines 72 to 76 in 2fa66cf
96aa0a9 to
8a6d4d5
Compare
|
Did a quick fix-up for the linter error ( |
thaJeztah
left a comment
There was a problem hiding this comment.
LGTM (assuming CI is happy)
|
Hm... this one looks related (failing on windows); Other test is probably a flaky; |
integration/volume/volume_test.go
Outdated
| _, err = io.Copy(io.Discard, resp.Body) | ||
| resp.Body.Close() | ||
| assert.NilError(t, err) |
There was a problem hiding this comment.
Does this need the ugly hack we use elsewhere to check if the image was actually built? (I have a feeling there's still other tests that don't check for this, because of the kinda horrible streaming response);
moby/integration/build/build_test.go
Lines 521 to 524 in 2fa66cf
|
Pushed a commit to capture the output; So, something looks broken indeed in the test (or does the Windows driver not generate a name now for the anonymous volume?) Or is it something silly and does |
|
This is the error; Which comes from; Lines 23 to 26 in 2fa66cf The Line 39 in 2fa66cf Which uses moby/volume/mounts/windows_parser.go Line 297 in 2fa66cf This is where things get a bit confusing, as that RegExp looks to be parsing the raw spec according to the moby/volume/mounts/windows_parser.go Line 86 in 2fa66cf But in the Dockerfile, this would only be destination (not source), unless the |
Hmm.. I guess that's still "okay" because moby/volume/mounts/windows_parser.go Lines 304 to 310 in 2fa66cf But I guess Windows also needs the same changes as we did for non-windows (i.e., don't generate a name there?) Lines 28 to 31 in 2fa66cf |
So, yes, it looks like we need something like this; moby/integration-cli/docker_cli_build_test.go Lines 88 to 97 in 2fa66cf |
cca29d4 to
2a6d7d0
Compare
|
Lines 23 to 26 in 2fa66cf
Looking at the original PR (#16433), that PR added |
a4d643f to
8b2bcb7
Compare
|
Almost; looks like |
8b2bcb7 to
bb5cbe4
Compare
|
Looks like CI is at least happy with the latest changes (but it needs cleaning up) |
e1f7c7e to
7810785
Compare
|
@cpuguy83 looks like something broke again 😢 |
7810785 to
67a231f
Compare
bdc7126 to
977661c
Compare
integration/volume/volume_test.go
Outdated
|
|
||
| var volumeName string | ||
| for _, m := range inspect.Mounts { | ||
| if m.Destination != volDest { |
There was a problem hiding this comment.
Looks like we're back to this part not finding the volume 😞 (I suspect here it expects it to be c:\foo)
82df2c6 to
b1a6e9b
Compare
|
finally it is green. |
|
Oh! My PR was merged, and looks like a (probably minor) merge conflict; I'll do a quick rebase in a bit |
Volumes created from the image config were not being pruned because the volume service did not think they were anonymous since the code to create passes along a generated name instead of letting the volume service generate it. This changes the code path to have the volume service generate the name instead of doing it ahead of time. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
b1a6e9b to
146df5f
Compare
Volumes created from the image config were not being pruned because the volume service did not think they were anonymous since the code to create passes along a generated name instead of letting the volume service generate it.
This changes the code path to have the volume service generate the name instead of doing it ahead of time.