feat: Add all linux platforms
This commit is contained in:
parent
de76312a38
commit
24a5c8d2b5
18 changed files with 185 additions and 78 deletions
|
|
@ -57,9 +57,8 @@ pub struct BuildCommand {
|
|||
/// than your hardware will require installing
|
||||
/// qemu. Build times will be much greater when
|
||||
/// building for a non-native architecture.
|
||||
#[arg(long, default_value = "native")]
|
||||
#[builder(default)]
|
||||
platform: Platform,
|
||||
#[arg(long)]
|
||||
platform: Option<Platform>,
|
||||
|
||||
/// The compression format the images
|
||||
/// will be pushed in.
|
||||
|
|
@ -198,7 +197,7 @@ impl BlueBuildCommand for BuildCommand {
|
|||
PathBuf::from(CONTAINER_FILE)
|
||||
}))
|
||||
.skip_validation(self.skip_validation)
|
||||
.platform(self.platform)
|
||||
.maybe_platform(self.platform)
|
||||
.recipe(recipe)
|
||||
.drivers(self.drivers)
|
||||
.build()
|
||||
|
|
@ -249,7 +248,7 @@ impl BuildCommand {
|
|||
&GenerateTagsOpts::builder()
|
||||
.oci_ref(&recipe.base_image_ref()?)
|
||||
.maybe_alt_tags(recipe.alt_tags.as_ref().map(CowCollecter::collect_cow_vec))
|
||||
.platform(self.platform)
|
||||
.maybe_platform(self.platform)
|
||||
.build(),
|
||||
)?;
|
||||
let image_name = self.image_name(&recipe)?;
|
||||
|
|
@ -283,7 +282,7 @@ impl BuildCommand {
|
|||
BuildTagPushOpts::builder()
|
||||
.image(&image)
|
||||
.containerfile(containerfile)
|
||||
.platform(self.platform)
|
||||
.maybe_platform(self.platform)
|
||||
.tags(tags.collect_cow_vec())
|
||||
.push(self.push)
|
||||
.retry_push(self.retry_push)
|
||||
|
|
@ -298,7 +297,7 @@ impl BuildCommand {
|
|||
|archive_dir| {
|
||||
BuildTagPushOpts::builder()
|
||||
.containerfile(containerfile)
|
||||
.platform(self.platform)
|
||||
.maybe_platform(self.platform)
|
||||
.image(PathBuf::from(format!(
|
||||
"{}/{}.{ARCHIVE_SUFFIX}",
|
||||
archive_dir.to_string_lossy().trim_end_matches('/'),
|
||||
|
|
@ -319,7 +318,7 @@ impl BuildCommand {
|
|||
.image(&image)
|
||||
.retry_push(self.retry_push)
|
||||
.retry_count(self.retry_count)
|
||||
.platform(self.platform)
|
||||
.maybe_platform(self.platform)
|
||||
.build(),
|
||||
)?;
|
||||
}
|
||||
|
|
@ -346,14 +345,14 @@ impl BuildCommand {
|
|||
&RechunkOpts::builder()
|
||||
.image(image_name)
|
||||
.containerfile(containerfile)
|
||||
.platform(self.platform)
|
||||
.maybe_platform(self.platform)
|
||||
.tags(tags.collect_cow_vec())
|
||||
.push(self.push)
|
||||
.version(format!(
|
||||
"{version}.<date>",
|
||||
version = Driver::get_os_version()
|
||||
.oci_ref(&recipe.base_image_ref()?)
|
||||
.platform(self.platform)
|
||||
.maybe_platform(self.platform)
|
||||
.call()?,
|
||||
))
|
||||
.retry_push(self.retry_push)
|
||||
|
|
@ -363,7 +362,7 @@ impl BuildCommand {
|
|||
Driver::get_metadata(
|
||||
&GetMetadataOpts::builder()
|
||||
.image(&base_image)
|
||||
.platform(self.platform)
|
||||
.maybe_platform(self.platform)
|
||||
.build(),
|
||||
)?
|
||||
.digest,
|
||||
|
|
|
|||
|
|
@ -73,8 +73,7 @@ pub struct GenerateCommand {
|
|||
/// Inspect the image for a specific platform
|
||||
/// when retrieving the version.
|
||||
#[arg(long, default_value = "native")]
|
||||
#[builder(default)]
|
||||
platform: Platform,
|
||||
platform: Option<Platform>,
|
||||
|
||||
/// Skips validation of the recipe file.
|
||||
#[arg(long, env = BB_SKIP_VALIDATION)]
|
||||
|
|
@ -148,7 +147,7 @@ impl GenerateCommand {
|
|||
.os_version(
|
||||
Driver::get_os_version()
|
||||
.oci_ref(&recipe.base_image_ref()?)
|
||||
.platform(self.platform)
|
||||
.maybe_platform(self.platform)
|
||||
.call()?,
|
||||
)
|
||||
.build_id(Driver::get_build_id())
|
||||
|
|
@ -161,7 +160,7 @@ impl GenerateCommand {
|
|||
Driver::get_metadata(
|
||||
&GetMetadataOpts::builder()
|
||||
.image(&base_image)
|
||||
.platform(self.platform)
|
||||
.maybe_platform(self.platform)
|
||||
.build(),
|
||||
)?
|
||||
.digest,
|
||||
|
|
@ -186,14 +185,14 @@ impl GenerateCommand {
|
|||
|
||||
#[cached(
|
||||
result = true,
|
||||
key = "Platform",
|
||||
key = "Option<Platform>",
|
||||
convert = r#"{ platform }"#,
|
||||
sync_writes = "by_key"
|
||||
)]
|
||||
fn determine_scripts_tag(platform: Platform) -> Result<Reference> {
|
||||
fn determine_scripts_tag(platform: Option<Platform>) -> Result<Reference> {
|
||||
trace!("determine_scripts_tag({platform:?})");
|
||||
|
||||
let opts = GetMetadataOpts::builder().platform(platform);
|
||||
let opts = GetMetadataOpts::builder().maybe_platform(platform);
|
||||
format!("{BUILD_SCRIPTS_IMAGE_REF}:{}", shadow::COMMIT_HASH)
|
||||
.parse()
|
||||
.into_diagnostic()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue