Skip to content

converter: add dual EROFS image conversion#3

Open
SToPire wants to merge 2 commits into
erofs:mainfrom
SToPire:to-be-merge-converter
Open

converter: add dual EROFS image conversion#3
SToPire wants to merge 2 commits into
erofs:mainfrom
SToPire:to-be-merge-converter

Conversation

@SToPire

@SToPire SToPire commented Apr 24, 2026

Copy link
Copy Markdown
Member

Add --erofs-dual conversion support to generate an OCI image index that contains both legacy OCI manifests and matching EROFS manifests. The first layer of each legacy OCI manifest contains an annotation pointing to the corresponding EROFS manifest.

This dual-manifest image format helps support containerd versions without native EROFS snapshotter support through a proxy snapshotter, and also leaves room for future lazy-loading support, while preserving compatibility with traditional OCI image consumers.

Usage: ctr-erofs images convert --erofs-dual --oci localhost:5000/busybox:latest localhost:5000/busybox:erofs-dual

Source containerd commit: 36f8999b946ed1e078d46496796ca54401423e3f

Signed-off-by: Yifan Zhao <stopire@gmail.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds support for generating an OCI image index that contains both a “legacy” manifest (tar layers) and a corresponding EROFS manifest, connected via an annotation on the legacy manifest’s first layer.

Changes:

  • Introduces DualManifestConverter to build a dual-manifest OCI index and to convert per-platform entries in an existing index.
  • Adds --erofs-dual to ctr-erofs images convert to enable dual-manifest output (mutually exclusive with --erofs).
  • Adds a native image format spec doc and comprehensive unit tests for dual-manifest behavior.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
pkg/converter/dual_manifest.go Implements dual-manifest conversion logic and JSON (index/manifest/config) rewriting.
pkg/converter/dual_manifest_test.go Adds tests for manifest/index conversion, platform handling, and GC label behavior.
pkg/converter/converter.go Centralizes EROFS layer media type / legacy-layer annotation constants; uses constant in layer conversion.
cmd/ctr-erofs/commands/convert.go Adds --erofs-dual flag and wires index-conversion mode into containerd’s converter pipeline.
docs/erofs-native-image-spec.md Documents the dual-manifest index format, EROFS layer media type, and legacy-layer annotation contract.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/converter/manifests.go
Comment thread pkg/converter/manifests_test.go
@hsiangkao

Copy link
Copy Markdown
Member

how do we append os.feature here?

@SToPire

SToPire commented Apr 25, 2026

Copy link
Copy Markdown
Member Author

how do we append os.feature here?

The EROFS descriptor inherits the platform from the original index/legacy config and append "erofs" to Platform.OSFeatures

@SToPire SToPire force-pushed the to-be-merge-converter branch from 12f176b to 660d12f Compare April 25, 2026 03:53
@hsiangkao

hsiangkao commented Apr 25, 2026

Copy link
Copy Markdown
Member

how about renaming dual-manifest to manifests.

Add an --erofs-dual conversion mode that publishes an OCI image index
containing both the original legacy manifest and a corresponding EROFS
manifest for each selected platform. The legacy manifest is kept first
for fallback compatibility, while the EROFS one is marked with the erofs
OS feature.

The dual converter rewrites EROFS configs with diff IDs for the
generated EROFS blobs, stores EROFS layers using the native EROFS media
type, and adds an annotation on the first legacy layer pointing to the
matching EROFS manifest digest. It also preserves GC references for the
generated index, manifests, configs, and layers.

Assisted-by: Codex:GPT-5.4
Signed-off-by: Yifan Zhao <stopire@gmail.com>
@SToPire SToPire force-pushed the to-be-merge-converter branch from 660d12f to 0a26a59 Compare May 19, 2026 13:11
carry this annotation:

```text
containerd.io/snapshot/erofs.native-image.manifest.digest

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.

containerd.io/snapshot/erofs.native.manifest.digest

@@ -0,0 +1,115 @@
# EROFS Native Image Format

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.

I think we need some compatible-format words in the subject; since it's just used for containerd which don't have native erofs support, so we need to explicitly point it out in the subject.

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.

the docs file name needs adoption too.

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.

3 participants