Skip to content

util/estargz: simplify implementation and define consts for labels #5933

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

thaJeztah
Copy link
Member

No description provided.

Comment on lines +58 to +59
// [estargz.StoreUncompressedSizeAnnotation]: https://pkg.go.dev/github.com/containerd/stargz-snapshotter/estargz@v0.16.3#StoreUncompressedSizeAnnotation
StoreUncompressedSizeAnnotation = "io.containers.estargz.uncompressed-size"
Copy link
Member Author

Choose a reason for hiding this comment

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

Curious why this uses a different prefix (io.containers.estargz) than the other ones, which all use containerd.io/.. 😅

Copy link
Collaborator

Choose a reason for hiding this comment

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

This is because this annotation is necessary to make the filesystem work with github.com/containers/storage library which is used by Podman/CRI-O. c.f. https://github.com/containerd/stargz-snapshotter/blob/2f71f9ea81620e302c5ec6384597fc630fbc6656/estargz/types.go#L78-L82

@thaJeztah thaJeztah marked this pull request as ready for review April 19, 2025 12:31
Comment on lines +72 to +75
if err := labels.Validate(TargetImageLayersLabel, layers+l.Digest.String()); err != nil {
break
}
layers += ls
layers += l.Digest.String() + ","
Copy link
Member Author

Choose a reason for hiding this comment

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

Slight change here; previously this would check the length including the trailing ,, but when setting the label, we trim the trailing comma, so there would be a potential off-by-one here, where we'd skip the label for being too long, even if it wasn't?

@AkihiroSuda AkihiroSuda requested a review from ktock April 23, 2025 06:50
Copy link
Collaborator

@ktock ktock left a comment

Choose a reason for hiding this comment

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

Thanks.

// This annotation is valid only when it is specified in `.[]layers.annotations`
// of an image manifest.
//
// This is a copy of [estargz.TOCJSONDigestAnnotation]
Copy link
Member

Choose a reason for hiding this comment

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

Why isn't this imported (or upstream constant just used instead). Same for next.

Copy link
Member Author

Choose a reason for hiding this comment

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

I went back-and-forth a bit; initially I had these as alias (TOCJSONDigestAnnotation = estargz.TOCJSONDigestAnnotation), but as we already would have to define the non-exported ones locally (and the estargz package containing much more than just the consts), and these consts to not change, I thought it would be OK to just have our own copy, as long as we refer to where they originate from.

thaJeztah added 2 commits May 8, 2025 16:35
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
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.

3 participants