Skip to content

allow lookup of artifact by digest#589

Merged
mheon merged 1 commit into
podman-container-tools:mainfrom
baude:issue408
Jan 26, 2026
Merged

allow lookup of artifact by digest#589
mheon merged 1 commit into
podman-container-tools:mainfrom
baude:issue408

Conversation

@baude

@baude baude commented Jan 13, 2026

Copy link
Copy Markdown
Contributor

Issue #408 describes libartifact not working for use cases where consumers want to look up an artifact by it's digest. This allows, among other things, for inspect to be done by digest.

Fixes #408

@github-actions github-actions Bot added the common Related to "common" package label Jan 13, 2026
podmanbot pushed a commit to podmanbot/buildah that referenced this pull request Jan 13, 2026
@podmanbot

Copy link
Copy Markdown

✅ A new PR has been created in buildah to vendor these changes: podman-container-tools/buildah#6635

@mtrmac mtrmac left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ACK otherwise.

(I’m sighing about the AI verbosity but I’ll leave those stylistic choices entirely to the primary authors of these packages.)

Comment thread common/pkg/libartifact/store/store.go Outdated
Comment thread common/pkg/libartifact/store/store.go Outdated
@packit-as-a-service

Copy link
Copy Markdown

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

podmanbot pushed a commit to podmanbot/buildah that referenced this pull request Jan 16, 2026

@mtrmac mtrmac left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ACK overall. Primarily the “do a string match first” comment — I don’t feel strongly that it is blocking, but I did want to at least discuss that.

Comment thread common/pkg/libartifact/artifact.go Outdated
Comment thread common/pkg/libartifact/artifact.go Outdated
Comment thread common/pkg/libartifact/artifact.go Outdated
Comment thread common/pkg/libartifact/store.go Outdated
continue
}
if storedRef.Name() == lookupRef.Name() {
artifactDigest := a.GetDigest()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This only matches against digest.Canonical. I think not supporting arbitrary digests (and having to compute them from rawManifest for now is perfectly fine. In particular it’s unclear what the registry API will look like, it seems they are leaning towards every object on the registry having an associated digest algorithm, with no expectation of cross-digest references (push by sha256; pull by sha512) to work, so maybe references by arbitrary digests will never be necessary.

One thing that we can cheaply do is do the a.Name == lookupName loop first, unconditionally; that might might match a digest cheaply, and it might match a non-sha256 digest if the artifact was pulled using one. Only if that fails, do this loop that parses references. That would not allow (pull by tag; reference by sha512 digest) but (pull by sha512 digest; reference by sha512 digest) would work, a small step forward and a microoptimization :) (A downside is that it would not be easy to unit-test.)

Comment thread common/pkg/libartifact/store.go
Comment thread common/pkg/libartifact/store.go Outdated
@baude baude marked this pull request as draft January 26, 2026 15:50
@baude

baude commented Jan 26, 2026

Copy link
Copy Markdown
Contributor Author

this pr revealed a problem in podman ... i'm going to fix that and repush. when the draft status ahs been removed, its ready for merge

@mtrmac mtrmac left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM from container-libs side (but we’ve been talking about a Podman-side concern, so not merging yet).

@mtrmac

mtrmac commented Jan 26, 2026

Copy link
Copy Markdown
Contributor

From another discussion

remove GetDigest and re-export Digest

LGTM to that as well.

Issue podman-container-tools#408 describes libartifact not working for use cases where
consumers want to look up an artifact by it's digest. This allows, among
other things, for inspect to be done by digest.

As part of this fix, did some refactoring of the package itself for the
convenience of the expanded Artifact struct.  Artifacts now have the
digest and raw manifest as a []byte within its structure.  There are
accessors for both.  Moreover, GetDigest no longer returns an error.

Fixes podman-container-tools#408

Signed-off-by: Brent Baude <bbaude@redhat.com>
@baude baude marked this pull request as ready for review January 26, 2026 19:29
@mheon

mheon commented Jan 26, 2026

Copy link
Copy Markdown
Contributor

LGTM

@mheon mheon merged commit 1e46b07 into podman-container-tools:main Jan 26, 2026
36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

common Related to "common" package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can't specify artifact by digest when it's pulled by tag

4 participants