Skip to content

Conversation

@piotrjanik
Copy link

@piotrjanik piotrjanik commented Dec 4, 2025

What this PR does / why we need it

This PR adds an --oci-layout flag to ocm download artifact and ocm download resources commands to produce OCI Image Layout compliant output.

Changes Introduced

New --oci-layout Flag

When specified, OCI artifacts are downloaded with:

  • Nested blob directories: blobs/sha256/<digest> instead of blobs/sha256.<digest>
  • OCI Image Layout files: index.json + oci-layout
  • Proper tagging: Resource version added to org.opencontainers.image.ref.name annotation

New Format Constant

Added FORMAT_OCI_COMPLIANT (oci/v1+compliant) which behaves like FORMAT_OCI but uses nested blob directory structure per OCI Image Layout specification.

Behavior

Command Without --oci-layout With --oci-layout
download artifact Flat blob paths Nested blob paths, OCI compliant
download resources Standard handlers OCI layout handler for OCI artifacts

ref.name Annotation

  • download artifact: Uses tag from source reference (e.g., latest)
  • download resources: Uses resource version

Fixes #1668

@github-actions github-actions bot added kind/bugfix Bug component/ocm-cli OCM Command Line Interface size/m Medium labels Dec 4, 2025
@piotrjanik piotrjanik force-pushed the fix/oci-blob-path branch 3 times, most recently from da1e69b to 3c64d21 Compare December 5, 2025 15:20
@github-actions github-actions bot added the area/documentation Documentation related label Dec 5, 2025
@piotrjanik piotrjanik force-pushed the fix/oci-blob-path branch 2 times, most recently from b5a9e8c to ed1de51 Compare December 10, 2025 14:20
@github-actions github-actions bot added the component/github-actions Changes on GitHub Actions or within `.github/` directory label Dec 11, 2025
@piotrjanik piotrjanik force-pushed the fix/oci-blob-path branch 6 times, most recently from 4d5f150 to 4ece648 Compare December 11, 2025 23:09
@piotrjanik piotrjanik marked this pull request as ready for review December 11, 2025 23:23
@piotrjanik piotrjanik requested a review from a team as a code owner December 11, 2025 23:23
Copy link
Member

@jakobmoellerdev jakobmoellerdev left a comment

Choose a reason for hiding this comment

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

in general this is lgtm in approach for the artifact downloader, but:

  1. I was expecting the download resource to be fixed alongside, i only see ocm download artifact. whats the behavior for downloading resources with a downloader
  2. I think the test is not setup stable. you expect the docker daemon to be available but we should test against an actual OCI registry imho. nothing that will block the PR though

type accessObjectInfo struct {
accessobj.DefaultAccessObjectInfo
// ociBlobLayout enables OCI Image Layout Specification compliant blob paths.
// When true, blobs are stored at blobs/<algorithm>/<encoded> instead of blobs/<algorithm>.<encoded>.
Copy link
Member

Choose a reason for hiding this comment

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

the artifactset format should not receive an alternative form to be stored as OCI layout imho.

})

AfterAll(func() {
GinkgoWriter.Printf("Cleaning up registry packages in: %s\n", registryHost)
Copy link
Member

Choose a reason for hiding this comment

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

nit: we have ginkgo logger for such uses

Copy link
Author

Choose a reason for hiding this comment

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

@jakobmoellerdev I could not find such logger, can you point it?

Copy link
Member

Choose a reason for hiding this comment

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

@github-actions github-actions bot added the kind/dependency dependency update, etc. label Dec 12, 2025
Copy link
Member

@jakobmoellerdev jakobmoellerdev left a comment

Choose a reason for hiding this comment

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

Im pretty sure that this is breaking backwards compatibility. That is because the oci layout flag was present before and I believe we can now no longer read from layouts that had the "old" incorrect oci layout flag. I think we need to version this off... I have encountered a very similar issue during my testing of local blob compatibility

@github-actions github-actions bot added the size/l Large label Dec 30, 2025
@piotrjanik piotrjanik force-pushed the fix/oci-blob-path branch 4 times, most recently from 58d89bd to 0d1928c Compare January 2, 2026 10:26
<!-- markdownlint-disable MD041 -->
This change adds an optional --oci-layout flag to the
`ocm download artifacts|resources` command to store blobs at
blobs/<algorithm>/<encoded> per OCI Image Layout Specification
instead of the default blobs/<algorithm>.<encoded> format.

This enables compatibility with tools that expect OCI-compliant
blob paths.

<!--
Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
-->
Fixes open-component-model#1668

Signed-off-by: Piotr Janik <piotr.janik@sap.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/documentation Documentation related component/github-actions Changes on GitHub Actions or within `.github/` directory component/ocm-cli OCM Command Line Interface kind/bugfix Bug kind/dependency dependency update, etc. size/l Large size/m Medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Downloading artifact leads to broken OCI image layout

2 participants