Skip to content

project: Use ImageReference from containers_image_proxy#2204

Draft
Johan-Liebert1 wants to merge 1 commit into
bootc-dev:mainfrom
Johan-Liebert1:refactor-imgref
Draft

project: Use ImageReference from containers_image_proxy#2204
Johan-Liebert1 wants to merge 1 commit into
bootc-dev:mainfrom
Johan-Liebert1:refactor-imgref

Conversation

@Johan-Liebert1
Copy link
Copy Markdown
Collaborator

Refactor struct ImageReference as an alias to
containers_image_proxy::ImageReference, also refactor enum Transport as Transport from containers_image_proxy

Rename crate::lib::spec::ImageReference to ImageReferenceSig to avoid confusion with ImageReference from containers_image_proxy

Requires: bootc-dev/containers-image-proxy-rs#138

Refactor `struct ImageReference` as an alias to
`containers_image_proxy::ImageReference`, also refactor `enum Transport`
as Transport from containers_image_proxy

Rename `crate::lib::spec::ImageReference` to `ImageReferenceSig` to
avoid confusion with ImageReference from containers_image_proxy

Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
@github-actions github-actions Bot added area/install Issues related to `bootc install` area/ostree Issues related to ostree labels May 20, 2026
@bootc-bot bootc-bot Bot requested a review from cgwalters May 20, 2026 08:31
@Johan-Liebert1 Johan-Liebert1 mentioned this pull request May 20, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request renames the ImageReference struct to ImageReferenceSig across the library and replaces internal definitions of Transport and ImageReference in crates/ostree-ext with type aliases from containers_image_proxy. The review feedback identifies several opportunities to simplify the code by removing redundant Ok(...?) wrapping and explicit anyhow:: prefixes, as well as cleaning up a trailing doc comment in the container module.

/// Parse a base [`ImageReference`] from a CLI argument.
pub fn parse_base_imgref(s: &str) -> Result<ImageReference> {
ImageReference::try_from(s)
Ok(ImageReference::try_from(s)?)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The use of Ok(...?) is redundant here as ImageReference::try_from(s) already returns a Result compatible with the function's return type.

Suggested change
Ok(ImageReference::try_from(s)?)
ImageReference::try_from(s)

let all_images = all_images
.into_iter()
.map(|img| crate::container::ImageReference::try_from(img.as_str()))
.map(|img| -> Result<_> { Ok(crate::container::ImageReference::try_from(img.as_str())?) })
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The closure can be simplified by removing the redundant Ok(...?) wrapping and explicit return type annotation, as try_from already returns the expected Result type.

Suggested change
.map(|img| -> Result<_> { Ok(crate::container::ImageReference::try_from(img.as_str())?) })
.map(|img| crate::container::ImageReference::try_from(img.as_str()))

Comment on lines 192 to 194
/// Combination of a remote image reference and transport.
///
/// For example,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The doc comment "For example," is now trailing and refers to nothing since the struct definition and its fields were removed.

Suggested change
/// Combination of a remote image reference and transport.
///
/// For example,
/// Combination of a remote image reference and transport.

})
.chain(deployment_commits.into_iter().map(Ok))
.collect::<Result<Vec<_>>>()?;
.collect::<anyhow::Result<Vec<_>>>()?;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The explicit anyhow:: prefix is redundant here as Result is already aliased to anyhow::Result in this module.

Suggested change
.collect::<anyhow::Result<Vec<_>>>()?;
.collect::<Result<Vec<_>>>()?;

@kelvinmulonzi
Copy link
Copy Markdown

rerun

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

Labels

area/install Issues related to `bootc install` area/ostree Issues related to ostree

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants