feat(builder): Add rootfs implementation for reading OCI images#413
Open
craciunoiuc wants to merge 2 commits into
Open
feat(builder): Add rootfs implementation for reading OCI images#413craciunoiuc wants to merge 2 commits into
craciunoiuc wants to merge 2 commits into
Conversation
Signed-off-by: Cezar Craciunoiu <[email protected]>
Either through 'type: oci' or the 'oci://' prefix. Signed-off-by: Cezar Craciunoiu <[email protected]>
Contributor
Author
|
let me know if these single use functions you want to inline I found them significant enough to keep separate for now |
There was a problem hiding this comment.
Pull request overview
Adds support in the builder to treat OCI image references (registry, OCI layout, OCI archive) as rootfs sources, including logic to unpack regular OCI layers into a rootfs and to use a Unikraft-specific initrd component when present.
Changes:
- Detect OCI rootfs sources via URI schemes and route
BuildRootfsto a new OCI implementation. - Implement
buildRootfsOCIto load OCI images per requested platform, flatten layers into a directory, and package into CPIO/EROFS. - Update kraftfile-to-buildopts translation and expand unit/integration-style tests for OCI sources.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| internal/builder/rootfs.go | Adds OCI source detection + buildRootfsOCI (load, platform match, layer flatten, repack). |
| internal/builder/rootfs_test.go | Adds DetectSourceType tests for OCI schemes and integration-style rootfs OCI tests. |
| internal/builder/rootfs_oci_test.go | Adds helpers to generate local OCI archives used by tests. |
| internal/builder/kraftfile.go | Avoids filepath-joining when rootfs/ROM source is an OCI reference or explicitly typed OCI. |
| internal/builder/kraftfile_test.go | Adds coverage for OCI paths/types in kraftfile-to-buildopts conversion. |
| go.mod | Pulls in new (indirect) deps required by containerd/v2 usage. |
| go.sum | Updates sums for newly introduced transitive dependencies. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+63
to
+77
| layerDesc, layerBlob := tarGzipLayer(t, srcDir) | ||
|
|
||
| config := ocispec.Image{ | ||
| Platform: ocispec.Platform{ | ||
| Architecture: "amd64", | ||
| OS: "linux", | ||
| }, | ||
| Config: ocispec.ImageConfig{ | ||
| Cmd: []string{"/bin/sh"}, | ||
| }, | ||
| RootFS: ocispec.RootFS{ | ||
| Type: "layers", | ||
| DiffIDs: []digest.Digest{layerDesc.Digest}, | ||
| }, | ||
| } |
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.
Tested work and it seemed fine. Pasting again uses:
Case 1:
Case 2:
You can use these prefixes:
oci://,oci-layout://,oci-archive://taken fromimage-spec:Closes: TOOL-1073