Skip to content

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

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

HarshwardhanPatil07 wants to merge 8 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
@HarshwardhanPatil07
HarshwardhanPatil07 force-pushed the fix/switch-target-imgref branch 2 times, most recently from 75ea0d9 to 8055a2f Compare October 30, 2026 09:41
@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
@HarshwardhanPatil07
HarshwardhanPatil07 force-pushed the fix/switch-target-imgref branch 2 times, most recently from a63c7f4 to b00d6b9 Compare October 31, 2026 13:42

@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

Comment thread crates/lib/src/spec.rs Resolved
@Johan-Liebert1

Copy link
Copy Markdown
Member

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

Comment thread crates/lib/src/spec.rs Resolved
Comment thread crates/lib/src/bootc_composefs/gc.rs Resolved
Comment thread crates/lib/src/bootc_composefs/state.rs Resolved
Comment thread crates/lib/src/bootc_composefs/state.rs Resolved
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
Comment thread crates/lib/src/deploy.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/spec.rs Resolved
Johan-Liebert1 and others added 8 commits November 12, 2026 11:42
Allow switch to accept an update origin separate from the image fetched
now. Pass the target through OSTree staging and composefs switch so
later updates can follow the recorded reference.

Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
Co-authored-by: HarshwardhanPatil07 <harshpat@redhat.com>
Keep the pulled image name alongside a staged deployment when switch
chooses a different update origin. This prepares the staged state to
distinguish the delivery source from the recorded origin.

Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
Co-authored-by: HarshwardhanPatil07 <harshpat@redhat.com>
Require an explicit transport for the target and parse it using the
existing image reference type. Normalize 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>
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 update origin 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. Copy local deliveries from
host storage before importing them into the unified store.

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

Copy link
Copy Markdown
Member Author

rebased

live_container_images.insert(image_name);
}

// A delivery tag may have moved since a rollback deployment was pulled.

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.

Hmm this looks like something that should have been split out as a separate bugfix

/// Retain an already imported image commit under another image reference.
/// This performs no fetch and also works when the destination does not exist yet.
#[context("Setting image reference {imgref}")]
fn set_image_reference(repo: &ostree::Repo, imgref: &ImageReference, commit: &str) -> 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.

What's the value of this wrapper function?


if source_imgref != target_imgref {
config = config.section(crate::deploy::ORIGIN_BOOTC).item(
crate::deploy::ORIGIN_SOURCE_IMAGE,

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.

I want to better understand why we need to track the source image. This is the most complex part of this PR.

What would break exactly if we didn't?

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