Skip to content

spec: Note we don't canonicalize oci #1311

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

Merged
merged 1 commit into from
May 12, 2025

Conversation

cgwalters
Copy link
Collaborator

The previous code in trying to parse oci was wrong; the syntax for an oci transport is the same as oci-archive, which includes a file path (and there's no mechanism to quote : note).

The canonical logic for all of this stuff is in Go, there's no canonical Rust library (yet, though I did think about putting this in oci-spec).

Previous to this attempt to handle tagged+digested, we weren't parsing image references at all.

First, factor out a canonicalize_reference helper since that's what we're really doing here, it's independent of the transport.

Fix the canonicalize function to drop out trying to parse oci.

Add a separate test case that incorrectly passes just so it's a bit more obvious to fix this later.

Note that today at least skopeo rejects trying to fetch via tagged+digested form from an oci: so it's fine if we don't canonicalize here yet, even though it could confuse someone.

The previous code in trying to parse `oci` was wrong; the syntax
for an `oci` transport is the same as oci-archive, which
includes a file path (and there's no mechanism to quote `:` note).

The canonical logic for all of this stuff is in Go, there's
no canonical Rust library (yet, though I did think about putting
this in oci-spec).

Previous to this attempt to handle tagged+digested, we weren't
parsing image references at all.

First, factor out a `canonicalize_reference` helper since that's
what we're really doing here, it's independent of the *transport*.

Fix the canonicalize function to drop out trying to parse `oci`.

Add a separate test case that incorrectly passes just so it's
a bit more obvious to fix this later.

Note that today at least `skopeo` rejects trying to fetch
via tagged+digested form from an `oci:` so it's fine if
we don't canonicalize here yet, even though it could confuse
someone.

Signed-off-by: Colin Walters <walters@verbum.org>
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors image reference canonicalization logic by extracting a helper function (canonicalize_reference) to manage the transformation, and it adds tests to validate behavior.

  • Factored out the canonicalize_reference function to handle tag-and-digest logic
  • Adjusted canonicalization flow in ImageReference for different transports
  • Introduced tests to verify expected transformations and identify uncanonicalized OCI references
Comments suppressed due to low confidence (1)

lib/src/spec.rs:119

  • Typo in comment: 'canonicicalation' should be 'canonicalization'.
                // Check if the image reference needs canonicicalation

@cgwalters cgwalters requested a review from ckyrouac May 12, 2025 19:08
@cgwalters
Copy link
Collaborator Author

Ohh now that I look more closely it's just the Fedora rawhide provisioning which is failing. I am not sure we should actually be running jobs against Fedora rawhide in a gating fashion here, at least not until that project has more gating.

The same CI checks passed with c10s.

@cgwalters cgwalters merged commit 4978fdd into bootc-dev:main May 12, 2025
29 of 31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants