Skip to content

Conversation

@shi2wei3
Copy link
Contributor

@shi2wei3 shi2wei3 commented Dec 11, 2025

Add a new --from-downloaded flag to bootc upgrade that allows users to unlock a staged deployment created with --download-only without checking for newer updates from the registry.

This provides a way to apply already-downloaded updates without triggering a registry check, which is useful for scheduled maintenance workflows where the update was downloaded earlier and should now be applied at a scheduled time.

Usage:

Download update without applying

bootc upgrade --download-only

Later: Apply the staged update (no registry check)

bootc upgrade --from-downloaded

Or: Apply staged update and reboot immediately

bootc upgrade --from-downloaded --apply

The flag conflicts with --check and --download-only as those operations have different purposes. It can be combined with --apply to immediately reboot after unlocking the staged deployment.

This commit also updates the documentation (upgrades.md) to describe all three ways to apply a download-only update, and updates the download-only test case (test-25) to use --apply-staged instead of plain bootc upgrade when clearing the download-only flag.

Assisted-by: Claude Code (Sonnet 4.5)

@bootc-bot bootc-bot bot requested a review from ckyrouac December 11, 2025 10:53
@github-actions github-actions bot added the area/documentation Updates to the documentation label Dec 11, 2025
Copy link
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 introduces a new --apply-staged flag to bootc upgrade, allowing users to apply a previously downloaded update without checking for a newer one from the registry. This is a well-implemented feature that enhances scheduled maintenance workflows. The code changes are clear, and the documentation and tests have been updated accordingly. I have one minor suggestion to refactor a small part of the new logic to improve code clarity and efficiency.

Comment on lines 947 to 959
let staged_deployment = storage
.get_ostree()?
.staged_deployment()
.ok_or_else(|| anyhow::anyhow!("No staged deployment found"))?;

if staged_deployment.is_finalization_locked() {
storage
.get_ostree()?
.change_finalization(&staged_deployment)?;
println!("Staged deployment will now be applied on reboot");
} else {
println!("Staged deployment is already set to apply on reboot");
}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

To avoid calling storage.get_ostree()? multiple times, you can store its result in a variable and reuse it. This improves readability and is slightly more efficient.

        let ostree = storage.get_ostree()?;
        let staged_deployment = ostree
            .staged_deployment()
            .ok_or_else(|| anyhow::anyhow!("No staged deployment found"))?;

        if staged_deployment.is_finalization_locked() {
            ostree.change_finalization(&staged_deployment)?;
            println!("Staged deployment will now be applied on reboot");
        } else {
            println!("Staged deployment is already set to apply on reboot");
        }

/// The deployment will be applied on the next shutdown or reboot. Use with --apply to
/// reboot immediately.
#[clap(long, conflicts_with_all = ["check", "download_only"])]
pub(crate) apply_staged: bool,
Copy link
Collaborator

Choose a reason for hiding this comment

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

--apply-staged --apply "stutters" i.e. at first it looks redundant but it's not.

How about calling this --enqueue?

But maybe we can also add a shorthand --enqueue --apply ➡️ --apply-from-download ?

Or maybe the option is called --from-downloaded ? I kind of like that more than --enqueue.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the suggestion, --from-downloaded sounds more natural, updated.

@shi2wei3 shi2wei3 changed the title lib: Add --apply-staged flag for bootc upgrade lib: Add --from-downloaded flag for bootc upgrade Dec 12, 2025
Add a new --from-downloaded flag to bootc upgrade that allows users to
unlock a staged deployment created with --download-only without fetching
updates from the container image source.

This provides a way to apply already-downloaded updates without triggering
a fetch operation, which is useful for scheduled maintenance workflows where
the update was downloaded earlier and should now be applied at a scheduled
time.

Usage:
  # Download update without applying
  bootc upgrade --download-only

  # Later: Apply the staged update (without fetching from image source)
  bootc upgrade --from-downloaded

  # Or: Apply staged update and reboot immediately
  bootc upgrade --from-downloaded --apply

The flag conflicts with --check and --download-only as those operations
have different purposes. It can be combined with --apply to immediately
reboot after unlocking the staged deployment.

This commit also updates the documentation (upgrades.md) to describe all
three ways to apply a download-only update, and updates the download-only
test case (test-25) to use --from-downloaded instead of plain
'bootc upgrade' when clearing the download-only flag.

Assisted-by: Claude Code (Sonnet 4.5)
Signed-off-by: Wei Shi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/documentation Updates to the documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants