-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Move remaining image packages to daemon #50446
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
Conversation
f5597ad
to
75231e8
Compare
75231e8
to
02bd9a3
Compare
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 needs more work; it will break our cli
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.
Made a first pass, but may need to look at some in more depth
daemon/internal/image/spec/README.md
Outdated
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.
image/spec
was kept because it previously defined the image specification; we should consider removing it instead of moving. It has no place as an internal package.
daemon/internal/image/v1/imagev1.go
Outdated
"github.com/docker/docker/daemon/internal/image" | ||
"github.com/docker/docker/daemon/internal/layer" | ||
"github.com/docker/docker/image" |
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.
Do we still need this package at all? I started looking at this, but didn't finish; it looks to be used for "pre-1.9 compatibility";
Lines 438 to 457 in b10cbd9
v1ImgCreated := time.Unix(0, 0) | |
v1Img := image.V1Image{ | |
// This is for backward compatibility used for | |
// pre v1.9 docker. | |
Created: &v1ImgCreated, | |
} | |
if i == len(img.RootFS.DiffIDs)-1 { | |
v1Img = img.V1Image | |
} | |
rootFS := *img.RootFS | |
rootFS.DiffIDs = rootFS.DiffIDs[:i+1] | |
v1ID, err := v1.CreateID(v1Img, rootFS.ChainID(), parent) | |
if err != nil { | |
return nil, err | |
} | |
v1Img.ID = v1ID.Encoded() | |
if parent != "" { | |
v1Img.Parent = parent.Encoded() | |
} |
daemon/dockerversion/version_lib.go
Outdated
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 one will require changes to our build-scripts;
Lines 3 to 9 in b10cbd9
LDFLAGS="${LDFLAGS} \ | |
-X \"github.com/docker/docker/dockerversion.Version=${VERSION}\" \ | |
-X \"github.com/docker/docker/dockerversion.GitCommit=${GITCOMMIT}\" \ | |
-X \"github.com/docker/docker/dockerversion.BuildTime=${BUILDTIME}\" \ | |
-X \"github.com/docker/docker/dockerversion.PlatformName=${PLATFORM}\" \ | |
-X \"github.com/docker/docker/dockerversion.ProductName=${PRODUCT}\" \ | |
-X \"github.com/docker/docker/dockerversion.DefaultProductLicense=${DEFAULT_PRODUCT_LICENSE}\" " |
Lines 487 to 492 in b10cbd9
$ldflags = "-X 'github.com/docker/docker/dockerversion.Version="+$dockerVersion+"'" | |
$ldflags += " -X 'github.com/docker/docker/dockerversion.GitCommit="+$gitCommit+"'" | |
$ldflags += " -X 'github.com/docker/docker/dockerversion.BuildTime="+$env:BUILDTIME+"'" | |
$ldflags += " -X 'github.com/docker/docker/dockerversion.PlatformName="+$env:PLATFORM+"'" | |
$ldflags += " -X 'github.com/docker/docker/dockerversion.ProductName="+$env:PRODUCT+"'" | |
$ldflags += " -X 'github.com/docker/docker/dockerversion.DefaultProductLicense="+$env:DEFAULT_PRODUCT_LICENSE+"'" |
daemon/pkg/tarsum/tarsum_spec.md
Outdated
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.
pkg/tarsum also seems to define the specification; is it something to be preserved and moved separate from this repo?
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.
I think buildkit should own it, we have no use for it in the future in the engine but it is still useful for build
daemon/pkg/tarsum/tarsum.go
Outdated
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.
It looks like the only remaining use of this is in builder/remotecontext` (for the classic builder); do we know if it's still needed there? How does BuildKit do this? (ISTR it had its own implementation, which made me curious if we can share that if it's still needed); I'm not very familiar with how/why it's used exactly;
moby/daemon/builder/remotecontext/filehash.go
Lines 30 to 45 in a1ee566
tsh := &tarsumHash{hdr: hdr, Hash: sha256.New()} | |
tsh.Reset() // initialize header | |
return tsh, nil | |
} | |
type tarsumHash struct { | |
hash.Hash | |
hdr *tar.Header | |
} | |
// Reset resets the Hash to its initial state. | |
func (tsh *tarsumHash) Reset() { | |
// comply with hash.Hash and reset to the state hash had before any writes | |
tsh.Hash.Reset() | |
tarsum.WriteV1Header(tsh.hdr, tsh.Hash) | |
} |
61a4135
to
3d4e2ca
Compare
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.
SGTM
Signed-off-by: Derek McGowan <derek@mcg.dev>
Signed-off-by: Derek McGowan <derek@mcg.dev>
Signed-off-by: Derek McGowan <derek@mcg.dev>
Signed-off-by: Derek McGowan <derek@mcg.dev>
Signed-off-by: Derek McGowan <derek@mcg.dev>
Signed-off-by: Derek McGowan <derek@mcg.dev>
Signed-off-by: Derek McGowan <derek@mcg.dev>
Signed-off-by: Derek McGowan <derek@mcg.dev>
Signed-off-by: Derek McGowan <derek@mcg.dev>
Signed-off-by: Derek McGowan <derek@mcg.dev>
Signed-off-by: Derek McGowan <derek@mcg.dev>
Signed-off-by: Derek McGowan <derek@mcg.dev>
Signed-off-by: Derek McGowan <derek@mcg.dev>
Signed-off-by: Derek McGowan <derek@mcg.dev>
Signed-off-by: Derek McGowan <derek@mcg.dev>
Signed-off-by: Derek McGowan <derek@mcg.dev>
Signed-off-by: Derek McGowan <derek@mcg.dev>
Signed-off-by: Derek McGowan <derek@mcg.dev>
Signed-off-by: Derek McGowan <derek@mcg.dev>
Signed-off-by: Derek McGowan <derek@mcg.dev>
Signed-off-by: Derek McGowan <derek@mcg.dev>
…networking Signed-off-by: Derek McGowan <derek@mcg.dev>
Signed-off-by: Derek McGowan <derek@mcg.dev>
3d4e2ca
to
0abcdb7
Compare
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.
Been trending positive on this but giving it the official thumbsup. My mindset is we can continue to rehome inside the daemon module once it is created before stabilizing the module and creating a tag there.
@austinvazquez I think the general approach we agreed on earlier is to at least put all the daemon stuff that we know is not used in daemon. The other packages we know are being legitimately used, we can keep them outside. That gives us the option of ensuring that nothing under daemon is imported anywhere. |
@dmcgowan, okay most of this move still makes sense to me. The one I'm having trouble now with is pkg/tarsum. Would that stay in place? |
tarsum isn't used by any active projects, only used internally. There is probably more we can move to internal after a bit more vetting/splitting. |
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, thanks!
"github.com/docker/docker/internal/unshare" | ||
"github.com/docker/docker/daemon/internal/unshare" |
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 for this PR; considering if this package could be moved to a module in moby/sys
; it looks very self-contained and stable, and we currently maintain a fork of the code in moby/go-archive/chrootarchive
.
Yes, there's a bunch of things that need curating. Split cruft from relevant parts. |
Double-checked some of my older comments; I left some of them "unresolved" as a reminder for some follow-ups. I just merged my PR in docker/cli to remove the Let's bring this one in 👍 🎉 |
Moves packages associated with imagesand layers to daemon. Moves the relevant internal and pkgs into daemon as well.