chore: Remove feature flags
This commit is contained in:
parent
33bebb5e29
commit
f67dea41a3
23 changed files with 69 additions and 305 deletions
|
|
@ -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:?})");
|
||||
|
||||
|
|
|
|||
|
|
@ -233,7 +233,6 @@ mod test {
|
|||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(feature = "sigstore")]
|
||||
fn compatibility() {
|
||||
use crate::drivers::sigstore_driver::SigstoreDriver;
|
||||
|
||||
|
|
|
|||
|
|
@ -321,7 +321,6 @@ impl BuildDriver for DockerDriver {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(feature = "prune")]
|
||||
fn prune(opts: &super::opts::PruneOpts) -> Result<()> {
|
||||
trace!("DockerDriver::prune({opts:?})");
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -54,7 +54,6 @@ pub struct PushOpts<'scope> {
|
|||
}
|
||||
|
||||
#[derive(Debug, Clone, Builder)]
|
||||
#[cfg(feature = "prune")]
|
||||
pub struct PruneOpts {
|
||||
pub all: bool,
|
||||
pub volumes: bool,
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
||||
|
|
|
|||
|
|
@ -99,7 +99,6 @@ impl DetermineDriver<BuildDriverType> for Option<BuildDriverType> {
|
|||
#[derive(Debug, Clone, Copy, ValueEnum)]
|
||||
pub enum SigningDriverType {
|
||||
Cosign,
|
||||
#[cfg(feature = "sigstore")]
|
||||
Sigstore,
|
||||
}
|
||||
|
||||
|
|
@ -107,18 +106,10 @@ 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
|
||||
}
|
||||
*self.get_or_insert(
|
||||
blue_build_utils::check_command_exists("cosign")
|
||||
.map_or(SigningDriverType::Sigstore, |()| SigningDriverType::Cosign),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue