Skip to content

Commit

Permalink
Move the PuzzleFS Image Rootfs at the beginning of the layers array i…
Browse files Browse the repository at this point in the history
…n the Image Manifest

Let's make the PuzzleFS image rootfs the first layer so it's easy to
find. The LXC oci template also looks at the first layer in the array to
identify the image type (see getlayermediatype) [1]

[1] lxc/lxc@1a2da75

Signed-off-by: Ariel Miculas-Trif <[email protected]>
  • Loading branch information
ariel-miculas committed Sep 18, 2024
1 parent 24d7d44 commit fe75024
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion puzzlefs-lib/src/oci.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,16 @@ impl Image {
} else {
self.0.dir.write(&path, final_data)?;
}
image_manifest.layers_mut().push(descriptor.clone());

// Let's make the PuzzleFS image rootfs the first layer so it's easy to find
// The LXC oci template also looks at the first layer in the array to identify the image
// type (see getlayermediatype):
// https://github.com/lxc/lxc/commit/1a2da75b6e8431f3530ebd3f75442d3bd5eec5e2
if media_type.name() == PUZZLEFS_ROOTFS {
image_manifest.layers_mut().insert(0, descriptor.clone());
} else {
image_manifest.layers_mut().push(descriptor.clone());
}
Ok((descriptor, fs_verity_digest, compressed_blob))
}

Expand Down

0 comments on commit fe75024

Please sign in to comment.