cli: Add tag-aware upgrade operations#2094
cli: Add tag-aware upgrade operations#2094gursewak1997 wants to merge 1 commit intobootc-dev:mainfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces new bootc upgrade CLI options: --tag to specify a target image tag for an upgrade, and --list-tags to display available tags for the currently booted image's repository. It includes new helper functions derive_image_with_tag and list_tags_for_current_image to support this functionality, along with corresponding unit tests and documentation updates. A review comment suggests refactoring duplicated logic within the upgrade function for retrieving the current image and handling cases where it's not defined, as well as making error messages more specific.
4e09e3a to
893c24a
Compare
crates/lib/src/cli.rs
Outdated
| anyhow::bail!("Failed to list tags: {}", stderr); | ||
| } | ||
|
|
||
| let stdout = String::from_utf8_lossy(&output.stdout); |
There was a problem hiding this comment.
For things like this it would be a lot cleaner to use skopeo inspect which outputs JSON. I think it's almost always wrong to use from_utf8_lossy.
Perhaps this might be best done with upgrade --check? We could also cache the latest available tags there.
There was a problem hiding this comment.
I've switched to skopeo inspect with JSON parsing (parsing the RepoTags field) instead of from_utf8_lossy. Also integrated it with upgrade --check as an optional --show-tags flag.
Caching the tags during check is a good idea. I can add that if you think it's worth the added complexity.
9b73097 to
4c5ca28
Compare
Implements tag-based upgrades allowing users to switch between tags of the current image without typing the full registry path. Adds two new options to bootc upgrade: - --tag <TAG>: Upgrade to a different tag of the current image - --show-tags: Show available tags (requires --check) The --tag option works with all transport types (registry, containers-storage, oci, etc.) by using the proper OCI Reference API for registry images and string replacement for others. The --show-tags option integrates with --check as an optional flag, using skopeo inspect to parse the RepoTags JSON field. This keeps the default check operation fast while providing tag discovery when needed. Includes integration test using containers-storage transport to verify full tag-switching workflow without registry dependency. Signed-off-by: gursewak1997 <gursmangat@gmail.com>
4c5ca28 to
c7274c6
Compare
Implement bootc upgrade --tag and --list-tags to simplify tag-based image version management for customers who version images using tags.
This adds:
The --tag option derives the target image by replacing the tag portion of the current booted image reference. Only works when booted from registry transport images.
Organizations version container images with tags (:latest, :dev, :test, :prod) and this allows them to upgrade between versions without retyping full registry paths or using switch (which is semantically about changing images, not versions).
Assisted-by: Claude Sonnet 4.5