Skip to content

Commit c726e5f

Browse files
committed
podstorage: Skip copy if image already in bootc storage; mark digest dead_code
When an image was built via 'bootc image cmd build' it goes directly into bootc's containers-storage. pull_from_containers_storage should detect this and skip the copy step rather than trying to copy from the default (host) storage where the image does not exist. Also marks the digest field on ImageListEntry as dead_code since we now match by config digest (image ID) rather than manifest digest. Assisted-by: OpenCode (claude-sonnet-4-6@default) Signed-off-by: Colin Walters <walters@verbum.org>
1 parent 1929048 commit c726e5f

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

crates/lib/src/podman.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ pub(crate) struct Inspect {
1919
pub(crate) struct ImageListEntry {
2020
pub(crate) id: String,
2121
pub(crate) names: Option<Vec<String>>,
22-
/// Manifest digest for this image (e.g. `sha256:abc...`).
23-
///
24-
/// Populated by `podman image list --format=json` in modern podman versions.
25-
/// Used to cross-reference against composefs bootc tags.
22+
/// Manifest digest as reported by podman (may differ from the composefs
23+
/// OCI manifest digest when layers are recompressed during copy).
24+
/// Kept for diagnostic purposes; use `id` (config sha256) for matching.
25+
#[allow(dead_code)]
2626
pub(crate) digest: Option<String>,
2727
}
2828

crates/lib/src/podstorage.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,13 @@ impl CStorage {
451451
/// image stores when resolving a push source. Otherwise falls back to the
452452
/// default `/var/lib/containers/storage`.
453453
pub(crate) async fn pull_from_containers_storage(&self, image: &str) -> Result<()> {
454+
// If the image is already in bootc's own containers-storage (e.g. built
455+
// via `bootc image cmd build`), no copy is needed.
456+
if self.exists(image).await.unwrap_or(false) {
457+
tracing::debug!("Image {image} already in bootc storage; skipping copy");
458+
return Ok(());
459+
}
460+
454461
let ais = std::env::var("STORAGE_OPTS")
455462
.ok()
456463
.and_then(|v| {

0 commit comments

Comments
 (0)