Skip to content

Conversation

@ariel-miculas
Copy link
Collaborator

…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 #27

[1] https://github.com/opencontainers/image-spec/blob/main/manifest.md#guidance-for-an-empty-descriptor

…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
Copy link
Collaborator

Choose a reason for hiding this comment

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

Needs updating

Copy link
Collaborator Author

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())?;
Copy link
Collaborator

@cgwalters cgwalters Oct 13, 2024

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)?)
Copy link
Collaborator

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"?

Copy link
Collaborator Author

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.

Copy link
Collaborator

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!

@cgwalters cgwalters merged commit a943d18 into bootc-dev:main Oct 13, 2024
ariel-miculas added a commit to ariel-miculas/puzzlefs that referenced this pull request Oct 14, 2024
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>
TacitGlad added a commit to TacitGlad/NewFileSystem that referenced this pull request Mar 5, 2025
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>
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.

empty_config_descriptor doesn't create an empty descriptor

2 participants