feat(iso): Create generate-iso command (#192)

## Tasks

- [x] Add ctrl-c handler to kill spawned children
- [x] add more args to support all variables
- [x] Add integration test
This commit is contained in:
Gerald Pinder 2024-09-04 18:17:08 -04:00 committed by GitHub
parent 4634f40840
commit e6cce3d542
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
25 changed files with 737 additions and 201 deletions

View file

@ -93,15 +93,15 @@ impl GenerateCommand {
});
debug!("Deserializing recipe");
let recipe_de = Recipe::parse(&recipe_path)?;
trace!("recipe_de: {recipe_de:#?}");
let recipe = Recipe::parse(&recipe_path)?;
trace!("recipe_de: {recipe:#?}");
if self.display_full_recipe {
if let Some(output) = self.output.as_ref() {
std::fs::write(output, serde_yaml::to_string(&recipe_de).into_diagnostic()?)
std::fs::write(output, serde_yaml::to_string(&recipe).into_diagnostic()?)
.into_diagnostic()?;
} else {
syntax_highlighting::print_ser(&recipe_de, "yml", self.syntax_theme)?;
syntax_highlighting::print_ser(&recipe, "yml", self.syntax_theme)?;
}
return Ok(());
}
@ -109,9 +109,9 @@ impl GenerateCommand {
info!("Templating for recipe at {}", recipe_path.display());
let template = ContainerFileTemplate::builder()
.os_version(Driver::get_os_version(&recipe_de)?)
.os_version(Driver::get_os_version(&recipe.base_image_ref()?)?)
.build_id(Driver::get_build_id())
.recipe(&recipe_de)
.recipe(&recipe)
.recipe_path(recipe_path.as_path())
.registry(Driver::get_registry()?)
.repo(Driver::get_repo_url()?)
@ -142,7 +142,3 @@ impl GenerateCommand {
Ok(())
}
}
// ======================================================== //
// ========================= Helpers ====================== //
// ======================================================== //