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

rust/rpmostree-client: parse OCI deployment manifest #5266

Open
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 nested escaped JSON.

Add a method to get the base oci manifest deserialized into an ImageManifest from the oci-spec rust crate.

Fixes #5196

Re-openning a new PR after #5208 was closed, given coreos/zincati#1241 (comment)

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

Add a method to get the base oci manifest deserialized into an
ImageManifest from the oci-spec rust crate.

Fixes coreos#5196
Copy link

openshift-ci bot commented Jan 30, 2025

@jbtrystram: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/kola-upgrade b0fb8b0 link true /test kola-upgrade
ci/prow/images b0fb8b0 link true /test images

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@jlebon
Copy link
Member

jlebon commented Jan 30, 2025

Hmm, did you mean to also update status --json with this?

But anyway, I think I'd rather just have that code in Zincati and parse ostree.manifest there? Anyway, we'll need that crate too there to be able to deserialize it, and that'll be useful too for when we get that info from bootc instead of rpm-ostree.


let manifest = self.base_commit_meta.get("ostree.manifest");
if let Some(inner) = manifest {
let deser = String::deserialize(inner)?;
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 cleaner to do something like:

if let Some(serde_json::Value::String(inner))) {
            let manifest: oci_spec::image::ImageManifest = serde_json::from_str(&inner)?;
            return Ok(Some(manifest));
}

or so, this String::deserialize is duplicating the value unnecessarily.

@cgwalters
Copy link
Member

Hmm, did you mean to also update status --json with this?

In theory that'd be a compatibility break right?

But anyway, I think I'd rather just have that code in Zincati and parse ostree.manifest there? Anyway, we'll need that crate too there to be able to deserialize it, and that'll be useful too for when we get that info from bootc instead of rpm-ostree.

Yes we still have the practical issue that zincati isn't using this code ref coreos/zincati#491

@jbtrystram
Copy link
Collaborator Author

But anyway, I think I'd rather just have that code in Zincati and parse ostree.manifest there?

Yes, that's my plan. I simply thought i'd share the patch in this repo as well in case that can help someone :)

Yes we still have the practical issue that zincati isn't using this code ref coreos/zincati#491

I'll try to pick up this one at some point !

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.

rpm-ostree status --json does not properly serialize ostree.manifest for OCI deployments
4 participants