ensure blob directory exists in archives#77
Merged
gjcolombo merged 2 commits intooxidecomputer:mainfrom Apr 28, 2025
Merged
Conversation
Contributor
Author
|
Whoops. Will look at the test failures when I get a minute. |
smklein
reviewed
Apr 28, 2025
| .join(self.service_name.as_str()) | ||
| .join(BLOB); | ||
|
|
||
| inputs.0.extend( |
Collaborator
There was a problem hiding this comment.
I believe tests are failing because we're adding these directories, even if no blob inputs actually exist
Collaborator
There was a problem hiding this comment.
The following change works for me:
fn get_blobs_inputs(&self, download_directory: &Utf8Path, zoned: bool) -> Result<BuildInputs> {
let mut inputs = BuildInputs::new();
+ let s3_blobs = self.source.blobs();
+ let buildomat_blobs = self.source.buildomat_blobs();
+ let any_blobs = s3_blobs.is_some() || buildomat_blobs.is_some();
+
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);
+
+ // Add the parent input directories to ensure they exist
+ // before adding the blobs themeselves.
+ //
+ // However, only do this work if the blobs actually exist.
+ if any_blobs {
+ 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() {
+ if let Some(s3_blobs) = s3_blobs {
...
- if let Some(buildomat_blobs) = self.source.buildomat_blobs() {
+ if let Some(buildomat_blobs) = buildomat_blobs {
Contributor
Author
There was a problem hiding this comment.
Thanks! Fixed in a0e6bbf, though I opted just to short-circuit the entire routine if there are no blobs to add. Let me know if you'd prefer an approach like the one you've outlined--I mostly went with short-circuiting because it seemed a bit sad to go through all the path computations unconditionally only to find out that we'll never use them because there's nothing to add.
smklein
approved these changes
Apr 28, 2025
Contributor
Author
|
Thanks for the fast turnaround, @smklein! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The helios-omicron-brand code that unpacks zone images requires all file entries in an archive to be preceded by entries that create those files' directories. Ensure the packaging code adds the requisite entries for downloaded blobs (as it already does for Rust programs).
Propolis will need a patch release containing this fix to produce functioning Omicron zone images, so I've bumped the package version to 0.12.2 in this commit; let me know if I should do that in a separate PR.
Tested by building a Propolis package using this commit and verifying that (a)
tar -tzfprints the appropriate output structure, and (b) hotpatching an Omicron dev cluster with this zone image allows instances to start (images created without the fix produce a file-not-found error when sled-agent tries to start them).