Skip to content

switch: Add --target-imgref to Support a separate update image reference - #2603

Open
HarshwardhanPatil07 wants to merge 10 commits into
bootc-dev:mainfrom
HarshwardhanPatil07:fix/switch-target-imgref
Open

HarshwardhanPatil07 wants to merge 10 commits into
bootc-dev:mainfrom
HarshwardhanPatil07:fix/switch-target-imgref

Conversation

@HarshwardhanPatil07

Copy link
Copy Markdown
Member

Adds --target-imgref to bootc switch for OSTree and composefs, allowing an image to be downloaded from a temporary source while keeping a different registry for future updates.

Manually verified composefs UKI switching, repeated switches, and reboot with the previous deployment available for rollback. Verified OSTree download-only staging and both references in its .origin file.

Fixes #2464

Copilot AI balanced review requested due to automatic review settings October 30, 2026 09:36

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@github-actions github-actions Bot added area/install Issues related to `bootc install` area/ostree Issues related to ostree area/documentation Updates to the documentation labels Oct 30, 2026
@bootc-bot
bootc-bot Bot requested a review from henrywang October 30, 2026 09:36
Johan-Liebert1 and others added 2 commits October 30, 2026 15:10
Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
Co-authored-by: HarshwardhanPatil07 <harshpat@redhat.com>
Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
Co-authored-by: HarshwardhanPatil07 <harshpat@redhat.com>
@HarshwardhanPatil07 HarshwardhanPatil07 changed the title switch: Add --target-imgref for offline image delivery switch: Add --target-imgref to Support a separate update image reference Oct 30, 2026
@cgwalters
cgwalters requested a balanced review from Copilot October 30, 2026 18:41
Comment thread crates/lib/src/cli.rs Resolved
Comment thread crates/lib/src/cli.rs Resolved

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Comment thread crates/lib/src/cli.rs Resolved
Comment thread crates/lib/src/cli.rs Resolved
Comment thread crates/lib/src/cli.rs Resolved
Comment thread crates/lib/src/deploy.rs Resolved
Offline delivery should accept the same registry names users pass to
install. Normalize target references before fetching, reject incompatible
options, and avoid advertising enforced verification on an unsupported
composefs path.

Assisted-by: AI
Signed-off-by: HarshwardhanPatil07 <harshpat@redhat.com>
A cached import must retain the reference used by the deployment origin
so cleanup does not discard its image metadata. Handle this in the
importer, respecting set_no_imgref, so direct and unified pulls share
the same behavior. Reuse the existing pull preparation helper.

Assisted-by: AI
Signed-off-by: HarshwardhanPatil07 <harshpat@redhat.com>
The update origin cannot identify which offline delivery was staged.
Record the pull source in each deployment origin and compare both
references before fetching, preserving download-only locks on repeats.
Route OSTree imports through the source while retaining the target.

Cover offline repeats, source replacement, activation, and provenance
after reboot on both backends.

Assisted-by: AI
Signed-off-by: HarshwardhanPatil07 <harshpat@redhat.com>
An identical image may be delivered with a different future update
origin. Reuse an existing staged image only when its OCI manifest matches
exactly, preserve its finalization lock, and avoid rewriting origins
shared with another deployment.

Assisted-by: AI
Signed-off-by: HarshwardhanPatil07 <harshpat@redhat.com>
Changing the origin of the running image should not replace the OS
rollback deployment. Stage a durable origin change and apply it during
finalization, validating the image and previous origin before writing.

Keep download-only state across reboot and integrate cancellation with
deployment deletion, rollback, and replacement. Cover recovery and the
activation lifecycle with unit and reboot tests.

Assisted-by: AI
Signed-off-by: HarshwardhanPatil07 <harshpat@redhat.com>
Recording an origin is only useful if later updates actually use it.
Extend the reboot test to check unchanged content and a newer image at
the recorded registry after completing an offline delivery.

Assisted-by: AI
Signed-off-by: HarshwardhanPatil07 <harshpat@redhat.com>
Explain how to obtain an image from a temporary source while retaining
the normal update origin. Document repeat behavior, activation, and
user-visible restrictions with local-storage and registry examples.

Assisted-by: AI
Signed-off-by: HarshwardhanPatil07 <harshpat@redhat.com>
A redirected deployment records its update origin while containers-storage
keeps the delivery name. Detect the stored host image by its OCI config
ID and retain that ID during cleanup, so later updates keep using unified
storage without requiring another explicit opt-in.

Use the existing deployment metadata for both backends without adding
persistent state or changing image aliases.

Assisted-by: AI
Signed-off-by: HarshwardhanPatil07 <harshpat@redhat.com>

@Johan-Liebert1 Johan-Liebert1 left a comment

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.

Not a full review yet

pub(crate) finalization_locked: bool,
}

impl OriginChange {

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.

Context on all the functions that return a Result would be nice

}
}

pub(crate) fn cancel(sysroot: &Dir) -> Result<()> {

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.

This function is poorly named. It's not clear what we're cancelling

.booted
.as_ref()
.context("No booted deployment")?;
if booted.require_composefs()?.verity != self.deployment

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.

when will this not be true? afaics, we're only ever setting OriginChange::deployment to the booted depl verity

opts,
UkiAddonCliOpts::Add { .. } | UkiAddonCliOpts::Remove { .. }
) {
anyhow::ensure!(

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.

why not? We allow it when we have a staged deployment

Comment thread crates/lib/src/spec.rs
}

/// Parse a transport-prefixed reference, defaulting bare image names to the registry.
pub(crate) fn parse_image_reference(value: &str) -> Result<containers_image_proxy::ImageReference> {

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.

Don't we already have containers_image_proxy::ImageReference::try_from?

@Johan-Liebert1

Copy link
Copy Markdown
Member

Also the first two commits need proper messages and not just wip

This branch has not been deployed

No deployments
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 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.

Add --target-imgref option to bootc switch

4 participants