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

image/config: Add helpers for config and annotations (labels) #143

Merged
merged 1 commit into from
Sep 18, 2023

Conversation

cgwalters
Copy link
Contributor

This is an extension of my previous PR to add a version API.

Basically, there are so many Option<T> to plow through to access the labels given an ImageConfiguration. Plus additionally it's more ergonomic to interact with &str and not &String in cases where auto-deref doesn't apply.

I tried to extend the existing config, but what I hit is that because we deserialize the labels as HashMap, we don't necessarily preserve the order...which is probably its own bug.

This is an extension of my previous PR to add a `version` API.

Basically, there are so many `Option<T>` to plow through to access
the labels given an ImageConfiguration.  Plus additionally it's
more ergonomic to interact with `&str` and not `&String` in
cases where auto-deref doesn't apply.

I tried to extend the existing config, but what I hit is that
because we deserialize the labels as `HashMap`, we don't necessarily
preserve the order...which is probably its own bug.

Signed-off-by: Colin Walters <walters@verbum.org>
@codecov-commenter
Copy link

Codecov Report

Merging #143 (18276c4) into main (1bfa419) will decrease coverage by 1.93%.
The diff coverage is 37.25%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #143      +/-   ##
==========================================
- Coverage   24.66%   22.74%   -1.93%     
==========================================
  Files          23       23              
  Lines        1885     2058     +173     
  Branches      935     1135     +200     
==========================================
+ Hits          465      468       +3     
- Misses        629      788     +159     
- Partials      791      802      +11     

Copy link
Member

@saschagrunert saschagrunert left a comment

Choose a reason for hiding this comment

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

LGTM, @utam0k please take a look

Copy link
Member

@utam0k utam0k left a comment

Choose a reason for hiding this comment

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

Thanks

@utam0k utam0k merged commit b512726 into containers:main Sep 18, 2023
6 checks passed
cgwalters added a commit to cgwalters/ostree-rs-ext that referenced this pull request Oct 3, 2023
This also relates to containers/oci-spec-rs#143

Basically getting the version from the config requires a helper,
this is a lot more convenient.
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.

None yet

4 participants