Skip to content
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

[WIP] parse OCI deployment status #5208

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jbtrystram
Copy link
Collaborator

When the deployment is an OCI image, the base_commit_meta field contains serialized JSON.

So the values in this map can either be:
- Regular OSTree case: a JSON object
- OCI case : a string containing a serialized JSON object

In the OCI case, simply deserialize the strings before passing them to serde, when necessary.

See #5196

Copy link

openshift-ci bot commented Jan 6, 2025

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@cgwalters
Copy link
Member

A lot of discussion in #5196

@cgwalters
Copy link
Member

The json-in-json we have now is obviously silly and unergonomic, and I am not opposed to trying to just change it. However, it is possible that something is parsing it as is today and there's some risk of breakage from that.

Per discussion in the issue, my inclination is basically to try to fix this a different way for now - ideally one that ends up using bootc and leave rpm-ostree as is.

@jlebon
Copy link
Member

jlebon commented Jan 7, 2025

Per discussion in the issue, my inclination is basically to try to fix this a different way for now - ideally one that ends up using bootc and leave rpm-ostree as is.

To be able to always query that info from bootc, I think it also needs to support fishing it out of the OSTree commit even if there are layered packages.

Anyway, feels weird to me to even have these keys in the --json output. We should probably filter it out like we do the rpmdb. OTOH, that would also technically be an API break at this point.

I guess forking ostree container image metadata is OK, though Zincati could also just re-deserialized the string itself since that's already in the rpm-ostree status output it captures. It's ugly but that'll also get cleaned up once we move to bootc.

@@ -49,6 +50,7 @@ pub struct Deployment {
pub pinned: bool,
pub checksum: String,
pub base_checksum: Option<String>,
#[serde(deserialize_with = "deserialize_base_commit_meta")]
Copy link
Member

Choose a reason for hiding this comment

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

I think it'd be easier (and more reliable) to just add a method to this get_base_manifest(&self) -> Result<Option<oci_spec::image::ImageManifest>> that directly accesses the expected key, instead of trying to heuristically parse every single metadata key as json.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants