chore: Ensure cargo installs use version for build scripts image

This commit is contained in:
Gerald Pinder 2024-05-07 20:16:22 -04:00
parent 55c1b087f7
commit 2923c417ab
4 changed files with 17 additions and 27 deletions

View file

@ -114,18 +114,12 @@ impl BugReportCommand {
}
fn get_recipe(&self) -> Option<Recipe> {
let recipe_path = self.recipe_path.clone().map_or_else(
|| {
get_config_file("recipe", "Enter path to recipe file").map_or_else(
|_| {
trace!("Failed to get recipe");
String::new()
},
|recipe| recipe,
)
},
|recipe_path| recipe_path,
);
let recipe_path = self.recipe_path.clone().unwrap_or_else(|| {
get_config_file("recipe", "Enter path to recipe file").unwrap_or_else(|_| {
trace!("Failed to get recipe");
String::new()
})
});
Recipe::parse(&recipe_path).ok()
}

View file

@ -13,7 +13,7 @@ use blue_build_utils::{
},
syntax_highlighting::{self, DefaultThemes},
};
use clap::Args;
use clap::{crate_version, Args};
use log::{debug, info, trace, warn};
use typed_builder::TypedBuilder;
@ -120,9 +120,12 @@ impl TemplateCommand {
.recipe_path(recipe_path.as_path())
.registry(self.get_registry())
.exports_tag(if shadow::COMMIT_HASH.is_empty() {
"latest"
// This is done for users who install via
// cargo. Cargo installs do not carry git
// information via shadow
format!("v{}", crate_version!())
} else {
shadow::COMMIT_HASH
shadow::COMMIT_HASH.to_string()
})
.build();

View file

@ -37,7 +37,7 @@ pub struct PushOpts<'a> {
pub struct BuildTagPushOpts<'a> {
/// The base image name.
///
/// NOTE: You cannot have this set with archive_path set.
/// NOTE: You cannot have this set with `archive-path` set.
#[builder(default, setter(into, strip_option))]
pub image: Option<Cow<'a, str>>,