Repository navigation
feat: add layer annotations for oras CLI compatibility - #25
Conversation
Add org.opencontainers.image.title annotations to layer descriptors so that 'oras pull' can extract them as named files (skill.yaml and <name>.tar.gz) instead of skipping layers without file names. Fixes #23 Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Pavel Anni <[email protected]>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
Cache: Disabled due to data retention organization setting Knowledge base: Disabled due to data retention organization setting 📝 WalkthroughWalkthroughThe PR implements dual OCI format support for skill distribution. Artifact mode (default) pushes each skill file as a separate OCI layer with title annotations for Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant Pack as Pack Operation
participant Registry as OCI Registry
participant Manifest as Manifest/Layers
Client->>Pack: Push skill (AsImage=false)
Pack->>Pack: Walk skill directory
Pack->>Pack: pushFileLayers: read each file
Pack->>Registry: Push each file as blob (FileMediaType)
Pack->>Pack: Annotate each layer (AnnotationTitle=filepath)
Pack->>Registry: Push config blob
Pack->>Manifest: Create manifest with annotated layers
Pack->>Registry: Store manifest
Pack-->>Client: Success
sequenceDiagram
participant Client
participant Pull as Pull Operation
participant Registry as OCI Registry
participant Manifest as Manifest Inspection
participant Filesystem as Filesystem
Client->>Pull: Pull skill
Pull->>Registry: Fetch manifest
Pull->>Manifest: Check for tarball layer (ContentMediaType)
alt Tarball Layer Found
Manifest-->>Pull: Image mode detected
Pull->>Registry: Fetch tar+gzip layer
Pull->>Filesystem: Extract tarball to extractDir
else No Tarball Layer
Manifest-->>Pull: Artifact mode detected
Pull->>Manifest: Iterate layers with AnnotationTitle
loop Per-file extraction
Pull->>Pull: Validate title (no path traversal)
Pull->>Registry: Fetch file layer
Pull->>Filesystem: Write file to extractDir
end
end
Pull-->>Client: Extraction complete
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Suppresses the "Skipped pulling layers without file name" warning from oras pull by adding org.opencontainers.image.title to the config descriptor in artifact mode. Fixes #23 Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Pavel Anni <[email protected]>
Root artifact-mode tarballs at "." instead of "<skill-name>/" so that 'oras pull -o <name>' extracts files directly without double nesting. Pull now creates a skill-name subdirectory from the SkillCard metadata, preserving multi-skill coexistence. Rename tarball title from <name>.tar.gz to content.tar.gz since the tarball no longer carries the skill name internally. Add config.json title annotation to suppress oras pull warning about layers without file names. Workflow for users without docsclaw: oras pull -o resume-screener quay.io/.../skill-resume-screener:1.0.0 cd resume-screener && tar xzf content.tar.gz Fixes #23 Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Pavel Anni <[email protected]>
Artifact mode (default) now pushes each file as a separate OCI layer with a title annotation. This enables 'oras pull' to extract files directly as named files — no tarball extraction needed. Image mode (--as-image) is unchanged: single tar+gzip layer for kubelet-mountable images on OpenShift 4.20+. Pull and Inspect detect the format automatically by inspecting layer media types and annotations. Both formats produce the same result on disk. Add ADR-0001 documenting the dual format decision and trade-offs. Fixes #23 Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Pavel Anni <[email protected]>
Restructure the guide around the two OCI formats: - Artifact (default): individual file layers for oras pull - Image (--as-image): single tarball for K8s image volumes Add comparison table, publishing workflow showing both pushes, oras pull example, and notes about which format to use where. Include securityContext in all example manifests. Reference ADR-0001 for design rationale. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Pavel Anni <[email protected]>
Security: - Add path traversal protection for file-per-layer pull (reject titles containing ".." or absolute paths, verify resolved path stays inside destination) - Skip dot-prefixed directories (.git, etc) in pushFileLayers Tests: - TestArtifactModeLayerAnnotations: verify layers have title annotations and correct media type - TestArtifactModePullExtractsFiles: verify round-trip produces correct files with expected content - TestImageModePushAndPull: verify image-mode round-trip works Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Pavel Anni <[email protected]>
Summary
Add
org.opencontainers.image.titleannotations to layer descriptorsso that
oras pullextracts them as named files instead of skipping.Before:
After:
6 lines changed in
internal/oci/pack.go. Only affects artifact mode(not
--as-image).Fixes #23
Test plan
make test— all passingmake lint— zero errorsoras pull🤖 Generated with Claude Code
Summary by CodeRabbit
Documentation
Tests