Skip to content

feat: add root_dir parameter to oci_layers_on_top#168

Merged
tarilabs merged 1 commit intocontainers:mainfrom
jonburdo:root-dir-for-layers
Apr 6, 2026
Merged

feat: add root_dir parameter to oci_layers_on_top#168
tarilabs merged 1 commit intocontainers:mainfrom
jonburdo:root-dir-for-layers

Conversation

@jonburdo
Copy link
Copy Markdown
Collaborator

This preserves subdirectory structure in layer arcnames if provided.

@jonburdo jonburdo force-pushed the root-dir-for-layers branch from 87c52ff to 529e3c8 Compare March 20, 2026 01:27
This preserves subdirectory structure in layer arcnames if provided.

Signed-off-by: Jon Burdo <jon@jonburdo.com>
@jonburdo
Copy link
Copy Markdown
Collaborator Author

I've just gotten back to testing this with model-registry and verifying that it works as expected there in save_to_oci_registry: kubeflow/model-registry#2521 (comment)

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.

I have verified manually with:

poetry run python scripts/test_oras_py.py download quay.io/mmortari/demo20260406:oldsignature

to still be working the old way.

Then, I checked leveraging this new named parameter with:

poetry run python scripts/test_oras_py.py download quay.io/mmortari/demo20260406:newsignature

and local modification as:

diff --git a/scripts/test_oras_py.py b/scripts/test_oras_py.py
index dc5b75a..6968b9f 100644
--- a/scripts/test_oras_py.py
+++ b/scripts/test_oras_py.py
@@ -38,7 +38,7 @@ def main():
             print(f"  modelcard: {modelcard.relative_to(model_dir)}")
         for f in model_files:
             print(f"  {f.relative_to(model_dir)}")
-        oci_layers_on_top(layout_dir, model_files, modelcard)
+        oci_layers_on_top(layout_dir, model_files, modelcard, root_dir="download")
 
         print(f"Pushing to {args.dest} ...")
         oras_py_push(layout_dir, args.dest, insecure=args.insecure)

and results as intended (subdirectory preserved)

Thanks a lot @jonburdo !

@tarilabs tarilabs merged commit f012fae into containers:main Apr 6, 2026
16 checks passed
@jonburdo jonburdo deleted the root-dir-for-layers branch April 6, 2026 16:26
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