Adds local file support to the crane index subcommand #2223
Merged
MeBaranov merged 7 commits intogoogle:mainfrom Mar 11, 2026
Merged
Adds local file support to the crane index subcommand #2223MeBaranov merged 7 commits intogoogle:mainfrom
crane index subcommand #2223MeBaranov merged 7 commits intogoogle:mainfrom
Conversation
Refactors crane index append to unify the handling of local and remote references. - Adds support for appending local OCI layouts to other local layouts or remote indices. - Adds support for appending remote images/indices to local layouts. - Simplifies the internal logic by removing specific appender implementations in favor of a unified collectAddendums helper. - Updates isLocalReference to be more robust against false positives. - Adds comprehensive tests in cmd/crane/index_test.sh covering local-to-local, remote-to-local, and mixed scenarios. - Fixes loadImage to correctly handle multi-image OCI layouts when used as a source.
- Extracted local and remote append logic into dedicated helpers. - Added support for preserving platform metadata in local OCI layouts. - Moved isLocalReference to index.go with improved documentation. - Expanded index_test.sh with mixed-source, flattening, and Docker media type tests. - Added comprehensive comments for internal flow control and helpers.
Member
Collaborator
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2223 +/- ##
===========================================
- Coverage 71.67% 52.62% -19.05%
===========================================
Files 123 164 +41
Lines 9935 11091 +1156
===========================================
- Hits 7121 5837 -1284
- Misses 2115 4547 +2432
- Partials 699 707 +8 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds support to the
crane indexsubcommand to support local OCI layout directories and tarballs. It unifies the handling of local and remote references, allowing users to create, modify, and inspect indices across both local filesystems and remote registries.Key Features
crane index appendcan now target local directories. If the target directory does not exist, it is automatically initialized as a new OCI layout.crane index listsubcommand allows for inspecting the digests, media types, and platform information of any index (local or remote).os/archmetadata.--flattenflag to control whether appended indices are expanded into their constituent manifests or added as nested indices.--docker-empty-baseflag for creating indices with Docker-specific media types when required.Verification
Comprehensive integration tests in
cmd/crane/index_test.shverify: