-
Notifications
You must be signed in to change notification settings - Fork 9
new_empty_manifest: create a valid manifest with an empty config desc… #31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…riptor The empty descriptor is described in the image spec [1]. `new_empty_manifest` writes an empty config descriptor in the blobs directory, which results in a valid image layout specification. This is validated using the fsck function in the `test_new_empty_manifest` test. Fixes bootc-dev#27 [1] https://github.com/opencontainers/image-spec/blob/main/manifest.md#guidance-for-an-empty-descriptor Signed-off-by: Ariel Miculas-Trif <amiculas@cisco.com>
| /// Returned when the OCI Image Index (index.json) is missing | ||
| MissingImageIndex, | ||
| #[error("Unexpected media type {media_type}")] | ||
| /// Returned when the OCI Image Index (index.json) is missing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs updating
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch!
| let _: ImageConfiguration = self.read_json_blob(manifest.config())?; | ||
| } | ||
| MediaType::EmptyJSON => { | ||
| let _: EmptyDescriptor = self.read_json_blob(manifest.config())?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we do the below ⬇️ then I think we can just no-op here.
|
|
||
| if !self | ||
| .dir | ||
| .exists(OciDir::parse_descriptor_to_path(&empty_descriptor)?) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm actually I think the intent of adding a dedicated media type for this is that we don't need to store it, we could just synthesize it on demand right?
I guess if we don't store it then people calling read_json_blob on that type would get an error...but we can just tell them "don't do that"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well the reason for writing it to the disk is that I currently use an empty config for PuzzleFS, but skopeo won't copy the image if it detects that not all the descriptors are present in 'blobs/sha256' (even though I store the data inline, in the descriptor, as a base64 encoded empty json). So without writing the blob we end up with an image that's not conformant to the spec.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, sorry for making you repeat that. I think that's arguably a minor bug in skopeo but yep let's be compatible with it!
Now that [1] was merged into ocidir-rs, we can use the new_empty_manifest function and we'll get a valid OCI image with an empty config descriptor. [1] bootc-dev/ocidir-rs#31 Signed-off-by: Ariel Miculas-Trif <amiculas@cisco.com>
Now that [1] was merged into ocidir-rs, we can use the new_empty_manifest function and we'll get a valid OCI image with an empty config descriptor. [1] bootc-dev/ocidir-rs#31 Signed-off-by: Ariel Miculas-Trif <amiculas@cisco.com>
…riptor
The empty descriptor is described in the image spec [1].
new_empty_manifestwrites an empty config descriptor in the blobs directory, which results in a valid image layout specification. This is validated using the fsck function in thetest_new_empty_manifesttest.Fixes #27
[1] https://github.com/opencontainers/image-spec/blob/main/manifest.md#guidance-for-an-empty-descriptor