From 0fff7905d5b9783403de8e74f3cba7bff8d6f710 Mon Sep 17 00:00:00 2001 From: Greg Colombo Date: Mon, 28 Apr 2025 18:32:39 +0000 Subject: [PATCH 1/2] ensure blob directory exists in archive --- Cargo.toml | 2 +- src/package.rs | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index a1fdabb..829443a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "omicron-zone-package" -version = "0.12.1" +version = "0.12.2" authors = ["Sean Klein "] edition = "2021" rust-version = "1.81.0" diff --git a/src/package.rs b/src/package.rs index f033529..8bf9fd1 100644 --- a/src/package.rs +++ b/src/package.rs @@ -604,14 +604,21 @@ impl Package { let mut inputs = BuildInputs::new(); let destination_path = if zoned { - zone_archive_path( - &Utf8Path::new("/opt/oxide") - .join(self.service_name.as_str()) - .join(BLOB), - )? + let dst = Utf8Path::new("/opt/oxide") + .join(self.service_name.as_str()) + .join(BLOB); + + inputs.0.extend( + zone_get_all_parent_inputs(&dst)? + .into_iter() + .map(BuildInput::AddDirectory), + ); + + zone_archive_path(&dst)? } else { Utf8PathBuf::from(BLOB) }; + if let Some(s3_blobs) = self.source.blobs() { inputs.0.extend(s3_blobs.iter().map(|blob| { let from = download_directory From a0e6bbf0287e5780a49d1282868f4b129a385f99 Mon Sep 17 00:00:00 2001 From: Greg Colombo Date: Mon, 28 Apr 2025 20:11:10 +0000 Subject: [PATCH 2/2] only add blob directory if we really need it --- src/package.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/package.rs b/src/package.rs index 8bf9fd1..5ac52ca 100644 --- a/src/package.rs +++ b/src/package.rs @@ -603,6 +603,14 @@ impl Package { fn get_blobs_inputs(&self, download_directory: &Utf8Path, zoned: bool) -> Result { let mut inputs = BuildInputs::new(); + // If there are no blobs in the source description, there's no work to + // do. It's important to short-circuit here to avoid adding an empty + // blob directory entry to zone archives that won't actually contain + // any blobs. + if self.source.blobs().is_none() && self.source.buildomat_blobs().is_none() { + return Ok(inputs); + } + let destination_path = if zoned { let dst = Utf8Path::new("/opt/oxide") .join(self.service_name.as_str())