Skip to content

fix: use root_dir in save_to_oci_registry for correct OCI layer structure#2552

Merged
google-oss-prow[bot] merged 1 commit intokubeflow:mainfrom
jonburdo:fix/save-to-oci-registry-layers
Apr 7, 2026
Merged

fix: use root_dir in save_to_oci_registry for correct OCI layer structure#2552
google-oss-prow[bot] merged 1 commit intokubeflow:mainfrom
jonburdo:fix/save-to-oci-registry-layers

Conversation

@jonburdo
Copy link
Copy Markdown
Member

@jonburdo jonburdo commented Apr 6, 2026

Pass individual file paths with root_dir to oci_layers_on_top instead of top-level directory entries. This produces one layer per file (instead of one layer per subdirectory) while preserving the original directory structure in layer arcnames via olot's root_dir support.

Update the unit test to assert the new root_dir-based calling convention and add e2e test verification that inspects the actual OCI layout to confirm one-layer-per-file and correct path preservation.

Related to #2498
Resolves #2520

AI-assisted: Claude Code (Opus 4.6)

Description

How Has This Been Tested?

Merge criteria:

  • All the commits have been signed-off (To pass the DCO check)
  • The commits have meaningful messages
  • Automated tests are provided as part of the PR for major new functionalities; testing instructions have been added in the PR body (for PRs involving changes that are not immediately obvious).
  • The developer has manually tested the changes and verified that the changes work.
  • Code changes follow the kubeflow contribution guidelines.
  • For first time contributors: Please reach out to the Reviewers to ensure all tests are being run, ensuring the label ok-to-test has been added to the PR.

If you have UI changes

  • The developer has added tests or explained why testing cannot be added.
  • Included any necessary screenshots or gifs if it was a UI change.
  • Verify that UI/UX changes conform the UX guidelines for Kubeflow.

…ture

Pass individual file paths with root_dir to oci_layers_on_top instead of
top-level directory entries. This produces one layer per file (instead of
one layer per subdirectory) while preserving the original directory
structure in layer arcnames via olot's root_dir support.

Update the unit test to assert the new root_dir-based calling convention
and add e2e test verification that inspects the actual OCI layout to
confirm one-layer-per-file and correct path preservation.

Related to kubeflow#2498
Resolves kubeflow#2520

AI-assisted: Claude Code (Opus 4.6)
Signed-off-by: Jon Burdo <jon@jonburdo.com>
@jonburdo jonburdo force-pushed the fix/save-to-oci-registry-layers branch from 421e545 to cbf7c73 Compare April 6, 2026 22:02
Copy link
Copy Markdown
Member Author

@jonburdo jonburdo left a comment

Choose a reason for hiding this comment

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

For additional context see:

Comment on lines +396 to +398
# Extract the absolute path from the files found in the path
files = [file[0] for file in _get_files_from_path(model_files_path)] # type: ignore[arg-type]
oci_layers_on_top(local_image_path, files, modelcard, root_dir=model_files_path)
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Reverts back to what we add originally here, before a mitigation: https://github.com/kubeflow/model-registry/pull/2498/changes#diff-cd394845b1d31bff2290364330b210311c758b6f0b10ce787adaf91f7d6a6010L396-R400
and adds root_dir kwarg:

- oci_layers_on_top(local_image_path, files, modelcard)
+ oci_layers_on_top(local_image_path, files, modelcard, root_dir=model_files_path)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

love how simple it become


huggingface-hub = { version = ">=0.20.1,<1.8.0", optional = true }
olot = { version = "^0.1.6", optional = true }
olot = { version = "^0.1.17", optional = true }
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Upgrade needed for root_dir kwarg support in oci_layers_on_top

Copy link
Copy Markdown
Member

@tarilabs tarilabs left a comment

Choose a reason for hiding this comment

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

/lgtm

thanks a lot @jonburdo

Comment on lines +396 to +398
# Extract the absolute path from the files found in the path
files = [file[0] for file in _get_files_from_path(model_files_path)] # type: ignore[arg-type]
oci_layers_on_top(local_image_path, files, modelcard, root_dir=model_files_path)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

love how simple it become

Copy link
Copy Markdown
Member

@pboyd pboyd left a comment

Choose a reason for hiding this comment

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

/lgtm

@tarilabs
Copy link
Copy Markdown
Member

tarilabs commented Apr 7, 2026

/approve

@google-oss-prow
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: tarilabs

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@google-oss-prow google-oss-prow bot merged commit cd8ceb3 into kubeflow:main Apr 7, 2026
38 of 39 checks passed
@jonburdo jonburdo deleted the fix/save-to-oci-registry-layers branch April 7, 2026 17:17
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.

adjust save_to_oci_registry to create one layer per file

3 participants