chore: Remove feature flags

This commit is contained in:
Gerald Pinder 2025-05-31 13:15:40 -04:00
parent 33bebb5e29
commit f67dea41a3
23 changed files with 69 additions and 305 deletions

View file

@ -11,13 +11,13 @@ version = "0.9.12"
[workspace.dependencies]
bon = "3"
cached = "0.55"
cached = { version = "0.55", features = ["async"]}
chrono = "0.4"
clap = "4"
colored = "2"
comlexr = "1"
indexmap = { version = "2", features = ["serde"] }
indicatif = { version = "0.17", features = ["improved_unicode"] }
indicatif = { version = "0.17", features = ["improved_unicode", "rayon"] }
log = "0.4"
miette = "7"
nix = { version = "0.29" }
@ -73,16 +73,16 @@ clap-verbosity-flag = "3"
clap_complete = "4"
clap_complete_nushell = "4"
fuzzy-matcher = "0.3"
jsonschema = { version = "0.30", optional = true }
jsonschema = "0.30"
open = "5"
os_info = "3"
rayon = { version = "1", optional = true }
regex = { version = "1", optional = true }
rayon = "1"
regex = "1"
requestty = { version = "0.5", features = ["macros", "termion"] }
shadow-rs = { version = "1", default-features = false }
thiserror = "2"
urlencoding = "2"
yaml-rust2 = { version = "0.10", optional = true }
yaml-rust2 = "0.10"
cached.workspace = true
clap = { workspace = true, features = ["derive", "cargo", "unicode", "env"] }
@ -98,56 +98,15 @@ semver.workspace = true
serde.workspace = true
serde_json.workspace = true
serde_yaml.workspace = true
syntect = { workspace = true, optional = true }
syntect.workspace = true
tempfile.workspace = true
tokio = { workspace = true, optional = true }
tokio.workspace = true
bon.workspace = true
users.workspace = true
[features]
# Top level features
default = [
"v0_9_0"
]
# v0.9.0 features
v0_9_0 = [
"init",
"stages",
"copy",
"iso",
"switch",
"login",
"validate",
"sigstore",
"multi-recipe",
"prune",
"rechunk",
]
init = []
stages = ["blue-build-recipe/stages"]
copy = ["blue-build-recipe/copy"]
multi-recipe = ["dep:rayon", "indicatif/rayon"]
iso = []
switch = []
sigstore = ["blue-build-process-management/sigstore"]
login = []
validate = [
"dep:jsonschema",
"dep:rayon",
"dep:tokio",
"dep:yaml-rust2",
"dep:syntect",
"dep:regex",
"cached/async",
"blue-build-process-management/validate"
]
prune = [
"blue-build-process-management/prune"
]
rechunk = [
"blue-build-process-management/rechunk"
]
default = []
[dev-dependencies]
rusty-hook = "0.11"
@ -166,3 +125,9 @@ codegen-units = 1
strip = "none"
debug = false
panic = "abort"
[profile.dev]
debug = false
[profile.test]
debug = "line-tables-only"

View file

@ -19,7 +19,7 @@ nu-ansi-term = { version = "0.50", features = ["gnu_legacy"] }
os_pipe = { version = "1", features = ["io_safety"] }
rand = "0.9"
signal-hook = { version = "0.3", features = ["extended-siginfo"] }
sigstore = { version = "0.11", features = ["full-rustls-tls", "cached-client", "sigstore-trust-root", "sign"], default-features = false, optional = true }
sigstore = { version = "0.11", features = ["full-rustls-tls", "cached-client", "sigstore-trust-root", "sign"], default-features = false }
zeroize = { version = "1", features = ["aarch64", "derive", "serde"] }
cached.workspace = true
@ -38,7 +38,7 @@ semver.workspace = true
serde.workspace = true
serde_json.workspace = true
tempfile.workspace = true
tokio = { workspace = true, optional = true }
tokio.workspace = true
bon.workspace = true
users.workspace = true
uuid.workspace = true
@ -49,9 +49,3 @@ blue-build-utils = { version = "=0.9.12", path = "../utils", features = ["test"]
[lints]
workspace = true
[features]
sigstore = ["dep:tokio", "dep:sigstore"]
validate = ["dep:tokio"]
prune = []
rechunk = []

View file

@ -39,10 +39,9 @@ use crate::logging::Logger;
pub use self::{
buildah_driver::BuildahDriver, cosign_driver::CosignDriver, docker_driver::DockerDriver,
github_driver::GithubDriver, gitlab_driver::GitlabDriver, local_driver::LocalDriver,
podman_driver::PodmanDriver, skopeo_driver::SkopeoDriver, traits::*,
podman_driver::PodmanDriver, sigstore_driver::SigstoreDriver, skopeo_driver::SkopeoDriver,
traits::*,
};
#[cfg(feature = "sigstore")]
pub use sigstore_driver::SigstoreDriver;
mod buildah_driver;
mod cosign_driver;
@ -53,7 +52,6 @@ mod gitlab_driver;
mod local_driver;
pub mod opts;
mod podman_driver;
#[cfg(feature = "sigstore")]
mod sigstore_driver;
mod skopeo_driver;
mod traits;
@ -335,7 +333,6 @@ impl BuildDriver for Driver {
impl_build_driver!(login())
}
#[cfg(feature = "prune")]
fn prune(opts: &opts::PruneOpts) -> Result<()> {
impl_build_driver!(prune(opts))
}
@ -349,8 +346,6 @@ macro_rules! impl_signing_driver {
($func:ident($($args:expr),*)) => {
match Self::get_signing_driver() {
SigningDriverType::Cosign => CosignDriver::$func($($args,)*),
#[cfg(feature = "sigstore")]
SigningDriverType::Sigstore => SigstoreDriver::$func($($args,)*),
}
};
@ -476,7 +471,6 @@ impl CiDriver for Driver {
}
}
#[cfg(feature = "rechunk")]
impl ContainerMountDriver for Driver {
fn mount_container(opts: &opts::ContainerOpts) -> Result<types::MountId> {
PodmanDriver::mount_container(opts)
@ -491,14 +485,12 @@ impl ContainerMountDriver for Driver {
}
}
#[cfg(feature = "rechunk")]
impl OciCopy for Driver {
fn copy_oci_dir(opts: &opts::CopyOciDirOpts) -> Result<()> {
SkopeoDriver::copy_oci_dir(opts)
}
}
#[cfg(feature = "rechunk")]
impl RechunkDriver for Driver {
fn rechunk(opts: &opts::RechunkOpts) -> Result<Vec<String>> {
PodmanDriver::rechunk(opts)

View file

@ -23,13 +23,7 @@ struct BuildahVersionJson {
pub struct BuildahDriver;
impl DriverVersion for BuildahDriver {
// RUN mounts for bind, cache, and tmpfs first supported in 1.24.0
// https://buildah.io/releases/#changes-for-v1240
#[cfg(not(feature = "prune"))]
const VERSION_REQ: &'static str = ">=1.24";
// The prune command wasn't present until 1.29
#[cfg(feature = "prune")]
const VERSION_REQ: &'static str = ">=1.29";
fn version() -> Result<Version> {
@ -194,7 +188,6 @@ impl BuildDriver for BuildahDriver {
Ok(())
}
#[cfg(feature = "prune")]
fn prune(opts: &super::opts::PruneOpts) -> Result<()> {
trace!("PodmanDriver::prune({opts:?})");

View file

@ -233,7 +233,6 @@ mod test {
}
#[test]
#[cfg(feature = "sigstore")]
fn compatibility() {
use crate::drivers::sigstore_driver::SigstoreDriver;

View file

@ -321,7 +321,6 @@ impl BuildDriver for DockerDriver {
Ok(())
}
#[cfg(feature = "prune")]
fn prune(opts: &super::opts::PruneOpts) -> Result<()> {
trace!("DockerDriver::prune({opts:?})");

View file

@ -3,7 +3,6 @@ use clap::ValueEnum;
pub use build::*;
pub use ci::*;
pub use inspect::*;
#[cfg(feature = "rechunk")]
pub use rechunk::*;
pub use run::*;
pub use signing::*;
@ -11,7 +10,6 @@ pub use signing::*;
mod build;
mod ci;
mod inspect;
#[cfg(feature = "rechunk")]
mod rechunk;
mod run;
mod signing;

View file

@ -54,7 +54,6 @@ pub struct PushOpts<'scope> {
}
#[derive(Debug, Clone, Builder)]
#[cfg(feature = "prune")]
pub struct PruneOpts {
pub all: bool,
pub volumes: bool,

View file

@ -19,6 +19,11 @@ use oci_distribution::Reference;
use serde::Deserialize;
use tempfile::TempDir;
use super::{
ContainerMountDriver, RechunkDriver,
opts::{CreateContainerOpts, RemoveContainerOpts, RemoveImageOpts},
types::{ContainerId, MountId},
};
use crate::{
drivers::{
BuildDriver, DriverVersion, InspectDriver, RunDriver,
@ -29,13 +34,6 @@ use crate::{
signal_handler::{ContainerRuntime, ContainerSignalId, add_cid, remove_cid},
};
#[cfg(feature = "rechunk")]
use super::{ContainerMountDriver, RechunkDriver, types::MountId};
use super::{
opts::{CreateContainerOpts, RemoveContainerOpts, RemoveImageOpts},
types::ContainerId,
};
const SUDO_PROMPT: &str = "Password for %u required to run 'podman' as privileged";
#[derive(Deserialize, Debug, Clone)]
@ -305,7 +303,6 @@ impl BuildDriver for PodmanDriver {
Ok(())
}
#[cfg(feature = "prune")]
fn prune(opts: &super::opts::PruneOpts) -> Result<()> {
trace!("PodmanDriver::prune({opts:?})");
@ -402,7 +399,6 @@ fn get_metadata_cache(opts: &GetMetadataOpts) -> Result<ImageMetadata> {
.inspect(|metadata| trace!("{metadata:#?}"))
}
#[cfg(feature = "rechunk")]
impl ContainerMountDriver for PodmanDriver {
fn mount_container(opts: &super::opts::ContainerOpts) -> Result<MountId> {
let use_sudo = opts.privileged && !running_as_root();
@ -501,7 +497,6 @@ impl ContainerMountDriver for PodmanDriver {
}
}
#[cfg(feature = "rechunk")]
impl RechunkDriver for PodmanDriver {}
impl RunDriver for PodmanDriver {

View file

@ -63,7 +63,6 @@ fn get_metadata_cache(opts: &GetMetadataOpts) -> Result<ImageMetadata> {
serde_json::from_slice(&output.stdout).into_diagnostic()
}
#[cfg(feature = "rechunk")]
impl super::OciCopy for SkopeoDriver {
fn copy_oci_dir(opts: &super::opts::CopyOciDirOpts) -> Result<()> {
use crate::logging::CommandLogging;

View file

@ -16,8 +16,6 @@ use crate::drivers::{
types::{CiDriverType, ImageRef},
};
#[cfg(feature = "sigstore")]
use super::sigstore_driver::SigstoreDriver;
use super::{
buildah_driver::BuildahDriver,
cosign_driver::CosignDriver,
@ -27,15 +25,15 @@ use super::{
local_driver::LocalDriver,
opts::{
BuildOpts, BuildTagPushOpts, CheckKeyPairOpts, CreateContainerOpts, GenerateImageNameOpts,
GenerateKeyPairOpts, GenerateTagsOpts, GetMetadataOpts, PushOpts, RemoveContainerOpts,
RemoveImageOpts, RunOpts, SignOpts, SignVerifyOpts, TagOpts, VerifyOpts, VerifyType,
GenerateKeyPairOpts, GenerateTagsOpts, GetMetadataOpts, PushOpts, RechunkOpts,
RemoveContainerOpts, RemoveImageOpts, RunOpts, SignOpts, SignVerifyOpts, TagOpts,
VerifyOpts, VerifyType,
},
podman_driver::PodmanDriver,
sigstore_driver::SigstoreDriver,
skopeo_driver::SkopeoDriver,
types::{ContainerId, ImageMetadata},
types::{ContainerId, ImageMetadata, MountId},
};
#[cfg(feature = "rechunk")]
use super::{opts::RechunkOpts, types::MountId};
trait PrivateDriver {}
@ -58,11 +56,9 @@ impl_private_driver!(
CosignDriver,
SkopeoDriver,
CiDriverType,
SigstoreDriver,
);
#[cfg(feature = "sigstore")]
impl_private_driver!(SigstoreDriver);
/// Trait for retrieving version of a driver.
#[allow(private_bounds)]
pub trait DriverVersion: PrivateDriver {
@ -116,7 +112,6 @@ pub trait BuildDriver: PrivateDriver {
///
/// # Errors
/// Will error if the driver fails to prune.
#[cfg(feature = "prune")]
fn prune(opts: &super::opts::PruneOpts) -> Result<()>;
/// Runs the logic for building, tagging, and pushing an image.
@ -240,7 +235,6 @@ pub trait RunDriver: PrivateDriver {
}
#[allow(private_bounds)]
#[cfg(feature = "rechunk")]
pub(super) trait ContainerMountDriver: PrivateDriver {
/// Mounts the container
///
@ -261,13 +255,11 @@ pub(super) trait ContainerMountDriver: PrivateDriver {
fn remove_volume(opts: &super::opts::VolumeOpts) -> Result<()>;
}
#[cfg(feature = "rechunk")]
pub(super) trait OciCopy {
fn copy_oci_dir(opts: &super::opts::CopyOciDirOpts) -> Result<()>;
}
#[allow(private_bounds)]
#[cfg(feature = "rechunk")]
pub trait RechunkDriver: RunDriver + BuildDriver + ContainerMountDriver {
const RECHUNK_IMAGE: &str = "ghcr.io/hhd-dev/rechunk:v1.0.1";

View file

@ -99,7 +99,6 @@ impl DetermineDriver<BuildDriverType> for Option<BuildDriverType> {
#[derive(Debug, Clone, Copy, ValueEnum)]
pub enum SigningDriverType {
Cosign,
#[cfg(feature = "sigstore")]
Sigstore,
}
@ -107,19 +106,11 @@ impl DetermineDriver<SigningDriverType> for Option<SigningDriverType> {
fn determine_driver(&mut self) -> SigningDriverType {
trace!("SigningDriverType::determine_signing_driver()");
#[cfg(feature = "sigstore")]
{
*self.get_or_insert(
blue_build_utils::check_command_exists("cosign")
.map_or(SigningDriverType::Sigstore, |()| SigningDriverType::Cosign),
)
}
#[cfg(not(feature = "sigstore"))]
{
SigningDriverType::Cosign
}
}
}
#[derive(Debug, Clone, Copy, ValueEnum)]
@ -272,49 +263,41 @@ impl AsRef<std::ffi::OsStr> for ContainerId {
}
}
#[cfg(feature = "rechunk")]
pub struct MountId(pub(super) String);
#[cfg(feature = "rechunk")]
impl std::fmt::Display for MountId {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", &self.0)
}
}
#[cfg(feature = "rechunk")]
impl AsRef<std::ffi::OsStr> for MountId {
fn as_ref(&self) -> &std::ffi::OsStr {
self.0.as_ref()
}
}
#[cfg(feature = "rechunk")]
impl<'a> From<&'a MountId> for std::borrow::Cow<'a, str> {
fn from(value: &'a MountId) -> Self {
Self::Borrowed(&value.0)
}
}
#[cfg(feature = "rechunk")]
#[derive(Debug, Clone)]
pub struct OciDir(String);
#[cfg(feature = "rechunk")]
impl std::fmt::Display for OciDir {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", &self.0)
}
}
#[cfg(feature = "rechunk")]
impl AsRef<std::ffi::OsStr> for OciDir {
fn as_ref(&self) -> &std::ffi::OsStr {
self.0.as_ref()
}
}
#[cfg(feature = "rechunk")]
impl TryFrom<std::path::PathBuf> for OciDir {
type Error = miette::Report;

View file

@ -6,7 +6,6 @@ pub mod drivers;
pub mod logging;
pub mod signal_handler;
#[cfg(any(feature = "sigstore", feature = "validate"))]
pub static ASYNC_RUNTIME: std::sync::LazyLock<tokio::runtime::Runtime> =
std::sync::LazyLock::new(|| {
tokio::runtime::Builder::new_multi_thread()

View file

@ -22,10 +22,5 @@ serde_yaml.workspace = true
serde_json.workspace = true
bon.workspace = true
[features]
default = []
stages = []
copy = []
[lints]
workspace = true

View file

@ -69,10 +69,7 @@ impl<'a> ModuleRequiredFields<'a> {
}
#[must_use]
#[allow(clippy::missing_const_for_fn)]
pub fn get_copy_args(&'a self) -> Option<(Option<&'a str>, &'a str, &'a str)> {
#[cfg(feature = "copy")]
{
Some((
self.config.get("from").and_then(|from| from.as_str()),
self.config.get("src")?.as_str()?,
@ -80,12 +77,6 @@ impl<'a> ModuleRequiredFields<'a> {
))
}
#[cfg(not(feature = "copy"))]
{
None
}
}
#[must_use]
pub fn get_non_local_source(&'a self) -> Option<&'a str> {
let source = self.source.as_deref()?;

View file

@ -101,16 +101,10 @@ impl Recipe<'_> {
recipe.modules_ext.modules = Module::get_modules(&recipe.modules_ext.modules, None)?;
#[cfg(feature = "stages")]
if let Some(ref mut stages_ext) = recipe.stages_ext {
stages_ext.stages = crate::Stage::get_stages(&stages_ext.stages, None)?;
}
#[cfg(not(feature = "stages"))]
{
recipe.stages_ext = None;
}
Ok(recipe)
}

View file

@ -21,38 +21,16 @@ fn main() {
log::trace!("Parsed arguments: {args:#?}");
signal_handler::init(|| match args.command {
// #[cfg(feature = "init")]
// CommandArgs::Init(mut command) => command.run(),
// #[cfg(feature = "init")]
// CommandArgs::New(mut command) => command.run(),
CommandArgs::Build(mut command) => command.run(),
CommandArgs::Generate(mut command) => command.run(),
#[cfg(feature = "switch")]
CommandArgs::Switch(mut command) => command.run(),
#[cfg(feature = "login")]
CommandArgs::Login(mut command) => command.run(),
#[cfg(feature = "init")]
CommandArgs::New(mut command) => command.run(),
#[cfg(feature = "init")]
CommandArgs::Init(mut command) => command.run(),
#[cfg(feature = "iso")]
CommandArgs::GenerateIso(mut command) => command.run(),
#[cfg(feature = "validate")]
CommandArgs::Validate(mut command) => command.run(),
#[cfg(feature = "prune")]
CommandArgs::Prune(mut command) => command.run(),
CommandArgs::BugReport(mut command) => command.run(),
CommandArgs::Completions(mut command) => command.run(),
});
}

View file

@ -11,17 +11,11 @@ pub mod bug_report;
pub mod build;
pub mod completions;
pub mod generate;
#[cfg(feature = "iso")]
pub mod generate_iso;
#[cfg(feature = "init")]
pub mod init;
#[cfg(feature = "login")]
pub mod login;
#[cfg(feature = "prune")]
pub mod prune;
#[cfg(feature = "switch")]
pub mod switch;
#[cfg(feature = "validate")]
pub mod validate;
pub trait BlueBuildCommand {
@ -73,7 +67,6 @@ pub enum CommandArgs {
Generate(generate::GenerateCommand),
/// Generate an ISO for an image or recipe.
#[cfg(feature = "iso")]
GenerateIso(generate_iso::GenerateIsoCommand),
/// Switch your current OS onto the image
@ -85,7 +78,6 @@ pub enum CommandArgs {
///
/// NOTE: This can only be used if you have `rpm-ostree`
/// installed. This image will not be signed.
#[cfg(feature = "switch")]
#[command(
visible_alias("update"),
visible_alias("upgrade"),
@ -94,24 +86,19 @@ pub enum CommandArgs {
Switch(switch::SwitchCommand),
/// Login to all services used for building.
#[cfg(feature = "login")]
Login(login::LoginCommand),
/// Create a new bluebuild project.
#[cfg(feature = "init")]
New(init::NewCommand),
/// Create a new bluebuild project.
#[cfg(feature = "init")]
Init(init::InitCommand),
/// Validate your recipe file and display
/// errors to help fix problems.
#[cfg(feature = "validate")]
Validate(Box<validate::ValidateCommand>),
/// Clean up cache and images for build drivers.
#[cfg(feature = "prune")]
Prune(prune::PruneCommand),
/// Create a pre-populated GitHub issue with information about your configuration

View file

@ -27,6 +27,7 @@ use clap::Args;
use log::{debug, info, trace, warn};
use miette::{IntoDiagnostic, Result, bail};
use oci_distribution::Reference;
use rayon::prelude::*;
use tempfile::TempDir;
use crate::commands::generate::GenerateCommand;
@ -38,16 +39,9 @@ use super::BlueBuildCommand;
pub struct BuildCommand {
/// The recipe file to build an image
#[arg()]
#[cfg(feature = "multi-recipe")]
#[builder(into)]
recipe: Option<Vec<PathBuf>>,
/// The recipe file to build an image
#[arg()]
#[cfg(not(feature = "multi-recipe"))]
#[builder(into)]
recipe: Option<PathBuf>,
/// Push the image with all the tags.
///
/// Requires `--registry`,
@ -120,7 +114,6 @@ pub struct BuildCommand {
/// NOTE: This must be run as root!
#[arg(long, group = "archive_rechunk", env = blue_build_utils::constants::BB_BUILD_RECHUNK)]
#[builder(default)]
#[cfg(feature = "rechunk")]
rechunk: bool,
/// Use a fresh rechunk plan, regardless of previous ref.
@ -128,7 +121,6 @@ pub struct BuildCommand {
/// NOTE: Only works with `--rechunk`.
#[arg(long, env = blue_build_utils::constants::BB_BUILD_RECHUNK_CLEAR_PLAN)]
#[builder(default)]
#[cfg(feature = "rechunk")]
rechunk_clear_plan: bool,
/// The location to temporarily store files
@ -177,10 +169,6 @@ impl BlueBuildCommand for BuildCommand {
} else {
TempDir::new().into_diagnostic()?
};
#[cfg(feature = "multi-recipe")]
{
use rayon::prelude::*;
let recipe_paths = self.recipe.clone().map_or_else(|| {
let legacy_path = Path::new(CONFIG_PATH);
let recipe_path = Path::new(RECIPE_PATH);
@ -213,34 +201,9 @@ impl BlueBuildCommand for BuildCommand {
self.start(&recipe_paths, tempdir.path())
}
#[cfg(not(feature = "multi-recipe"))]
{
let recipe_path = self.recipe.clone().unwrap_or_else(|| {
let legacy_path = Path::new(CONFIG_PATH);
let recipe_path = Path::new(RECIPE_PATH);
if recipe_path.exists() && recipe_path.is_dir() {
recipe_path.join(RECIPE_FILE)
} else {
warn!("Use of {CONFIG_PATH} for recipes is deprecated, please move your recipe files into {RECIPE_PATH}");
legacy_path.join(RECIPE_FILE)
}
});
GenerateCommand::builder()
.output(tempdir.path().join(CONTAINER_FILE))
.recipe(&recipe_path)
.drivers(self.drivers)
.build()
.try_run()?;
self.start(&recipe_path, tempdir.path())
}
}
}
impl BuildCommand {
#[cfg(feature = "multi-recipe")]
fn start(&self, recipe_paths: &[PathBuf], temp_dir: &Path) -> Result<()> {
use rayon::prelude::*;
@ -274,24 +237,6 @@ impl BuildCommand {
Ok(())
}
#[cfg(not(feature = "multi-recipe"))]
fn start(&self, recipe_path: &Path, temp_dir: &Path) -> Result<()> {
trace!("BuildCommand::start()");
let images = self.build(recipe_path, &temp_dir.join(CONTAINER_FILE))?;
let color = gen_random_ansi_color();
info!(
"Finished building:\n{}",
images
.iter()
.map(|image| format!("\t- {}", color_str(image, color)))
.collect::<Vec<_>>()
.join("\n")
);
Ok(())
}
fn build(&self, recipe_path: &Path, containerfile: &Path) -> Result<Vec<String>> {
let recipe = Recipe::parse(recipe_path)?;
let tags = Driver::generate_tags(
@ -318,7 +263,15 @@ impl BuildCommand {
cache_image
});
let build_fn = || -> Result<Vec<String>> {
let images = if self.rechunk {
self.rechunk(
containerfile,
&recipe,
&tags,
&image_name,
cache_image.as_ref(),
)?
} else {
Driver::build_tag_push(&self.archive.as_ref().map_or_else(
|| {
BuildTagPushOpts::builder()
@ -349,25 +302,9 @@ impl BuildCommand {
.maybe_cache_to(cache_image.as_ref())
.build()
},
))
))?
};
#[cfg(feature = "rechunk")]
let images = if self.rechunk {
self.rechunk(
containerfile,
&recipe,
&tags,
&image_name,
cache_image.as_ref(),
)?
} else {
build_fn()?
};
#[cfg(not(feature = "rechunk"))]
let images = build_fn()?;
if self.push && !self.no_sign {
Driver::sign_and_verify(
&SignVerifyOpts::builder()
@ -382,7 +319,6 @@ impl BuildCommand {
Ok(images)
}
#[cfg(feature = "rechunk")]
fn rechunk(
&self,
containerfile: &Path,

View file

@ -19,9 +19,7 @@ use log::{debug, info, trace, warn};
use miette::{IntoDiagnostic, Result};
use oci_distribution::Reference;
#[cfg(feature = "validate")]
use crate::commands::validate::ValidateCommand;
use crate::shadow;
use crate::{commands::validate::ValidateCommand, shadow};
use super::BlueBuildCommand;
@ -103,7 +101,6 @@ impl GenerateCommand {
}
});
#[cfg(feature = "validate")]
ValidateCommand::builder()
.recipe(recipe_path.clone())
.build()

View file

@ -148,24 +148,12 @@ impl BlueBuildCommand for GenerateIsoCommand {
};
if let GenIsoSubcommand::Recipe { recipe } = &self.command {
#[cfg(feature = "multi-recipe")]
let mut build_command = {
BuildCommand::builder()
.recipe(vec![recipe.clone()])
.archive(image_out_dir.path())
.maybe_tempdir(self.tempdir.clone())
.build()
};
#[cfg(not(feature = "multi-recipe"))]
let mut build_command = {
BuildCommand::builder()
.recipe(recipe.clone())
.archive(image_out_dir.path())
.maybe_tempdir(self.tempdir.clone())
.build()
};
build_command.try_run()?;
.try_run()?;
}
let iso_name = self.iso_name.as_ref().map_or("deploy.iso", String::as_str);

View file

@ -66,20 +66,12 @@ impl BlueBuildCommand for SwitchCommand {
};
trace!("{tempdir:?}");
#[cfg(feature = "multi-recipe")]
BuildCommand::builder()
.recipe([self.recipe.clone()])
.archive(tempdir.path())
.maybe_tempdir(self.tempdir.clone())
.build()
.try_run()?;
#[cfg(not(feature = "multi-recipe"))]
BuildCommand::builder()
.recipe(self.recipe.clone())
.archive(tempdir.path())
.maybe_tempdir(self.tempdir.clone())
.build()
.try_run()?;
let recipe = Recipe::parse(&self.recipe)?;
let image_file_name = format!(

View file

@ -21,4 +21,3 @@ uuid.workspace = true
[lints]
workspace = true