feat: Add platform arg to force building a specific architecture

This commit is contained in:
Gerald Pinder 2024-09-29 17:00:37 -04:00
parent 20d1950530
commit 75eae89e4a
22 changed files with 408 additions and 71 deletions

View file

@ -2,6 +2,8 @@ use std::{borrow::Cow, path::Path};
use bon::Builder;
use crate::drivers::types::Platform;
use super::CompressionType;
/// Options for building
@ -15,14 +17,15 @@ pub struct BuildOpts<'scope> {
#[builder(into)]
pub containerfile: Cow<'scope, Path>,
#[builder(default)]
pub platform: Platform,
}
#[derive(Debug, Clone, Builder)]
#[builder(on(Cow<'_, str>, into))]
pub struct TagOpts<'scope> {
#[builder(into)]
pub src_image: Cow<'scope, str>,
#[builder(into)]
pub dest_image: Cow<'scope, str>,
}
@ -80,4 +83,8 @@ pub struct BuildTagPushOpts<'scope> {
/// Run all steps in a single layer.
#[builder(default)]
pub squash: bool,
/// The platform to build the image on.
#[builder(default)]
pub platform: Platform,
}

View file

@ -3,12 +3,17 @@ use std::borrow::Cow;
use bon::Builder;
use oci_distribution::Reference;
use crate::drivers::types::Platform;
#[derive(Debug, Clone, Builder)]
pub struct GenerateTagsOpts<'scope> {
pub oci_ref: &'scope Reference,
#[builder(into)]
pub alt_tags: Option<Vec<Cow<'scope, str>>>,
#[builder(default)]
pub platform: Platform,
}
#[derive(Debug, Clone, Builder)]

View file

@ -2,6 +2,8 @@ use std::borrow::Cow;
use bon::Builder;
use crate::drivers::types::Platform;
#[derive(Debug, Clone, Builder)]
pub struct GetMetadataOpts<'scope> {
#[builder(into)]
@ -9,4 +11,7 @@ pub struct GetMetadataOpts<'scope> {
#[builder(into)]
pub tag: Option<Cow<'scope, str>>,
#[builder(default)]
pub platform: Platform,
}

View file

@ -8,6 +8,8 @@ use bon::Builder;
use miette::{IntoDiagnostic, Result};
use zeroize::{Zeroize, Zeroizing};
use crate::drivers::types::Platform;
pub enum PrivateKey {
Env(String),
Path(PathBuf),
@ -112,4 +114,7 @@ pub struct SignVerifyOpts<'scope> {
/// Defaults to 1.
#[builder(default = 1)]
pub retry_count: u8,
#[builder(default)]
pub platform: Platform,
}