[Builder] Move file coping from the daemon to the builder#33454
[Builder] Move file coping from the daemon to the builder#33454vdemeester merged 3 commits intomoby:masterfrom
Conversation
0219fe7 to
20688cf
Compare
image/image.go
Outdated
There was a problem hiding this comment.
I think we can just stop using that field. I don't think it is used for anything, conflicts with #30611 etc.
There was a problem hiding this comment.
This is also used by commit. In that case it seems more relevant because it would be the ID of the source container.
What do you think about waiting to do this in a follow up? That way we can draw more attention to the change without the distraction of these other unrelated changes.
There was a problem hiding this comment.
Yes, I didn't notice that builder doesn't set it. It can be follow up.
builder/builder.go
Outdated
There was a problem hiding this comment.
This should be a conversion function AddHistory(image, history) image to make it explicit that this does not create any parent/child relationship.
There was a problem hiding this comment.
We could make a package that just contains the schema of the image type and directly use that pkg here instead of defining an image interface. We should not have a dependency on imagestore/layerstore though like the current image pkg has. This part could be a follow-up with a todo.
There was a problem hiding this comment.
I'm happy to remove this from the Image interface, I think that's a good change.
Isn't there a parent/child relationship that is established by the history?
I'm not really clear how this becomes AddHistory() though. In addition to history, the parent image is used for:
img.RootFSimg.OSFeatures/img.OSVersion
OSFeature/Version doesn't seem to be used for much. Do you think we could drop those as well?
Image.RootFS would have to be exposed somewhere if we don't pass in both images to this new function.
There was a problem hiding this comment.
AddHistory wasn't very clear name. I meant a function that appends to both history and rootfs array of the base image config. img.OSFeatures/OSVersion come from the base input image that is passed in. It is also missing Config/ContainerConfig that could be either added by this function on set manually by the caller as they carry no extra logic other than just setting a propery on a struct.
daemon/build.go
Outdated
There was a problem hiding this comment.
This should probably return releasableLayer. Otherwise it complicated the reference tracking as caller will need to get an image with this layer to release the current layer. You should not need to call the imagestore between steps in the future.
There was a problem hiding this comment.
Ok, I thought layer.DiffID was probably a bad return value, but wanted to keep it as simple as possible for now.
How should the DiffID of the new layer be exposed? Should releaseableLayer has a method DiffID() ?
There was a problem hiding this comment.
Should releaseableLayer has a method DiffID()
Yes
daemon/build.go
Outdated
There was a problem hiding this comment.
Do the empty layer detection in here.
There was a problem hiding this comment.
I'm not really sure what that looks like. The empty layer check is layer.IsEmpty() ? How can we do that check here and use the value in the new image?
There was a problem hiding this comment.
The point was to check if the layer was empty in here and discard it if it was. Then you do not need to access the layer package when you are adding to the diffID array in CreateImage. Empty commit means that rootfs part of the image config does not require updates.
builder/dockerfile/internals.go
Outdated
There was a problem hiding this comment.
line 102: should avoid creating a container
There was a problem hiding this comment.
Oops, good catch. I think I resolved a merge conflict incorrectly
0c30c9c to
23f4222
Compare
image/image.go
Outdated
b81495b to
23f4222
Compare
aeb87d2 to
5aaeeaf
Compare
|
LGTM, with cleaning up the dependency graph in a follow-up. |
Add CreateImage() to the daemon Refactor daemon.Comit() and expose a Image.NewChild() Update copy to use IDMappings. Signed-off-by: Daniel Nephin <[email protected]>
Signed-off-by: Daniel Nephin <[email protected]>
Commit the rwLayer to get the correct DiffID Refacator copy in thebuilder move more code into exportImage cleanup some windows tests Release the newly commited layer. Set the imageID on the buildStage after exporting a new image. Move archiver to BuildManager. Have ReleaseableLayer.Commit return a layer and store the Image from exportImage in the local imageSources cache Remove NewChild from image interface. Signed-off-by: Daniel Nephin <[email protected]>
5aaeeaf to
5136096
Compare
|
rebased, and squashed down to 3 commits |
|
This need one more LGTM, PTAL |
Implements items 4, 5, 6 in #32904
Removes
Daemon.CopyOnBuild()and moves the copy logic to the builder