Skip to content

deployment: enable adding custom metadata#3212

Draft
jmarrero wants to merge 1 commit intoostreedev:mainfrom
jmarrero:metadata
Draft

deployment: enable adding custom metadata#3212
jmarrero wants to merge 1 commit intoostreedev:mainfrom
jmarrero:metadata

Conversation

@jmarrero
Copy link
Copy Markdown
Member

@jmarrero jmarrero commented Mar 12, 2024

This is a Work in progress and is very bad atm, still need to re-work it with GVariant and test it, but it builds locally... somehow.

@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented Mar 12, 2024

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

}

ret = TRUE;
out:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

In brand new code we can avoid use of goto and just use return FALSE above


if (opt_get)
{
ostree_deployment_get_ext_metadata (first_deployment, *opt_get, error);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Need to handle errors here

{
g_autofree char *backing_relpath = _ostree_sysroot_get_deployment_backing_relpath (self);
g_autofree char *metadata_value = NULL;
g_autofree int len = getxattr (backing_relpath, metadata_key, NULL, 0);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

In the general case ostree wants to support using fd-relative paths, so we need to open a fd for the dir (relative to self->sysroot_fd), then use fgetxattr().

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Also

g_autofree int len

Definitely don't want to call free() on an integer. Also, getxattr returns a ssize_t, not an int (they're different sizes).

OstreeDeploymentUnlockedState ostree_deployment_get_unlocked (OstreeDeployment *self);

_OSTREE_PUBLIC
gboolean ostree_deployment_set_ext_metadata (OstreeDeployment *self, const char *metadata_key,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

New API needs to be added to libostree-devel.sym; there's some ceremony to do that. See the comments around that and git log.

@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented Mar 18, 2026

PR needs rebase.

Details

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.

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.

2 participants