Skip to content

Conversation

@mtrmac
Copy link
Contributor

@mtrmac mtrmac commented Dec 6, 2025

DO NOT MERGE: This is on top of #530 .

Add private.ImageReference.NewImageSourceWithOptions, and use it to pass digests.Options to transports that might need to compute digests.

Fully implement that in sif: and tarball:.

For docker-deamon: and docker-archive:, use digests.Options for the config digest, but do not use it for layers, to avoid an extra cost. See the detailed added comment for rationale. This also does not modify the destination parts of these transports at all.

Also 2 sort-of-unrelated bug fixes.

See individual commit messages for details.

Cc: @lsm5 (low priority)

@github-actions github-actions bot added the image Related to "image" package label Dec 6, 2025
@mtrmac
Copy link
Contributor Author

mtrmac commented Dec 6, 2025

Not to self: Absolutely untested at this point.

@mtrmac mtrmac marked this pull request as draft December 6, 2025 02:04
podmanbot pushed a commit to podmanbot/buildah that referenced this pull request Dec 6, 2025
@podmanbot
Copy link

✅ A new PR has been created in buildah to vendor these changes: containers/buildah#6574

@packit-as-a-service
Copy link

Packit jobs failed. @containers/packit-build please check.

1 similar comment
@packit-as-a-service
Copy link

Packit jobs failed. @containers/packit-build please check.

@mtrmac
Copy link
Contributor Author

mtrmac commented Jan 12, 2026

Now marked ready for review (but I still didn’t try this in practice).

podmanbot pushed a commit to podmanbot/buildah that referenced this pull request Jan 12, 2026
@mtrmac mtrmac marked this pull request as ready for review January 13, 2026 14:48
@mtrmac mtrmac force-pushed the choose-digest-tarball branch from 071cb96 to 4953ceb Compare January 13, 2026 14:51
podmanbot pushed a commit to podmanbot/buildah that referenced this pull request Jan 13, 2026
@mtrmac
Copy link
Contributor Author

mtrmac commented Jan 13, 2026

Manually-smoke-tested:

  • tarball: works (with a tarball, without the Go API to set config)
  • tarball:, with copy hard-coded to sha512, works and produces sha512 digests
  • I didn’t test sif:, that requires Linux and root IIRC
  • reads from docker-archive: work
  • reads from docker-archive: with copy hard-coded to sha512, work and produce sha512 config digest

// don’t matter.

if mustUse := options.Digests.MustUseSet(); mustUse != "" && mustUse != digest.Canonical {
logrus.Debugf("%q does not implement digest choices for image sources; request to use %s is ignored",
Copy link
Member

Choose a reason for hiding this comment

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

I'm thinking if this should be a warning or not. It seems like request is being ignored which sounds like something we should clearly see in the logs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this is going to end up visible in podman manifest and buildah (and eventually undesirable), but we’re pretty far away from that point, and using a warning here means we won’t forget to consider that situation. Updated.

@jankaluza
Copy link
Member

I've read the PR and also the surrounding code and it all makes sense to me and I don't see anything obviously wrong. But I'm no an expert here. So giving cautious +1.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Currently it is only called in oci/archive and openshift to forward
to another transport; real users will be added later.

Should not change behavior (yet).

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
This will make it a bit easier to use NewImageSourceOptions for transports
that might only implement the public types.ImageReference.

This commit does not (yet) add any callers, so this should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
…r-daemon:

Note that we DO NOT use options.Digest for the layer IDs; that would require
extra CPU cost to digest files more than once.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
@mtrmac mtrmac force-pushed the choose-digest-tarball branch from 4953ceb to 7347041 Compare January 16, 2026 19:31
podmanbot pushed a commit to podmanbot/buildah that referenced this pull request Jan 16, 2026
@podmanbot
Copy link

✅ A new PR has been created in buildah to vendor these changes: containers/buildah#6643

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

image Related to "image" package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants