fix: use root_dir in save_to_oci_registry for correct OCI layer structure#2552
Conversation
…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>
421e545 to
cbf7c73
Compare
jonburdo
left a comment
There was a problem hiding this comment.
For additional context see:
- PR for adding
root_dirtooci_layers_on_topinolot: containers/olot#168 - explanation of the problem and manual testing output: #2521 (comment)
| # 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) |
There was a problem hiding this comment.
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)|
|
||
| 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 } |
There was a problem hiding this comment.
Upgrade needed for root_dir kwarg support in oci_layers_on_top
| # 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) |
|
/approve |
|
[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 DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
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:
DCOcheck)ok-to-testhas been added to the PR.If you have UI changes