ci: fix Windows cross-compile by gating unix-only harmony code #291
@@ -98,10 +98,16 @@ inquire.workspace = true
|
|||||||
brocade = { path = "../brocade" }
|
brocade = { path = "../brocade" }
|
||||||
option-ext = "0.2.0"
|
option-ext = "0.2.0"
|
||||||
rand.workspace = true
|
rand.workspace = true
|
||||||
virt = { version = "0.4.3", optional = true }
|
|
||||||
podman-api = { version = "0.9", optional = true }
|
podman-api = { version = "0.9", optional = true }
|
||||||
sysinfo = "0.30"
|
sysinfo = "0.30"
|
||||||
|
|
||||||
|
# virt (libvirt bindings) uses std::os::unix and only compiles on Unix targets.
|
||||||
|
# Declaring it here (not in [dependencies]) prevents Cargo from trying to
|
||||||
|
# compile it when cross-compiling to Windows, even if a workspace member
|
||||||
|
# requests the `kvm` feature.
|
||||||
|
[target.'cfg(unix)'.dependencies]
|
||||||
|
virt = { version = "0.4.3", optional = true }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
pretty_assertions.workspace = true
|
pretty_assertions.workspace = true
|
||||||
assertor.workspace = true
|
assertor.workspace = true
|
||||||
|
|||||||
@@ -159,6 +159,7 @@ async fn ensure_cloud_image_unverified(
|
|||||||
|
|
||||||
info!("downloading cloud image {url} → {target:?} (one-time, sha not pinned)");
|
info!("downloading cloud image {url} → {target:?} (one-time, sha not pinned)");
|
||||||
download_to(url, &target).await?;
|
download_to(url, &target).await?;
|
||||||
|
#[cfg(unix)]
|
||||||
tokio::fs::set_permissions(&target, std::os::unix::fs::PermissionsExt::from_mode(0o644))
|
tokio::fs::set_permissions(&target, std::os::unix::fs::PermissionsExt::from_mode(0o644))
|
||||||
.await
|
.await
|
||||||
.map_err(|e| exec(format!("chmod image: {e}")))?;
|
.map_err(|e| exec(format!("chmod image: {e}")))?;
|
||||||
@@ -208,6 +209,7 @@ async fn ensure_cloud_image(
|
|||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
// World-readable so libvirt-qemu can open it without a chmod ritual.
|
// World-readable so libvirt-qemu can open it without a chmod ritual.
|
||||||
|
#[cfg(unix)]
|
||||||
tokio::fs::set_permissions(&target, std::os::unix::fs::PermissionsExt::from_mode(0o644))
|
tokio::fs::set_permissions(&target, std::os::unix::fs::PermissionsExt::from_mode(0o644))
|
||||||
.await
|
.await
|
||||||
.map_err(|e| exec(format!("chmod image: {e}")))?;
|
.map_err(|e| exec(format!("chmod image: {e}")))?;
|
||||||
@@ -300,6 +302,7 @@ async fn provision_ssh_keypair() -> Result<FleetSshKeypair, ExecutorError> {
|
|||||||
tokio::fs::create_dir_all(&dir)
|
tokio::fs::create_dir_all(&dir)
|
||||||
.await
|
.await
|
||||||
.map_err(|e| exec(format!("create ssh dir {dir:?}: {e}")))?;
|
.map_err(|e| exec(format!("create ssh dir {dir:?}: {e}")))?;
|
||||||
|
#[cfg(unix)]
|
||||||
tokio::fs::set_permissions(&dir, std::os::unix::fs::PermissionsExt::from_mode(0o700))
|
tokio::fs::set_permissions(&dir, std::os::unix::fs::PermissionsExt::from_mode(0o700))
|
||||||
.await
|
.await
|
||||||
.map_err(|e| exec(format!("chmod ssh dir: {e}")))?;
|
.map_err(|e| exec(format!("chmod ssh dir: {e}")))?;
|
||||||
@@ -368,6 +371,7 @@ async fn make_world_traversable(dir: &Path) -> Result<(), ExecutorError> {
|
|||||||
// We only adjust the terminal dir here; parents are assumed to be
|
// We only adjust the terminal dir here; parents are assumed to be
|
||||||
// world-traversable already (true by default on every distro's
|
// world-traversable already (true by default on every distro's
|
||||||
// data-dir layout: `~/.local/share` is 755 on user create).
|
// data-dir layout: `~/.local/share` is 755 on user create).
|
||||||
|
#[cfg(unix)]
|
||||||
tokio::fs::set_permissions(dir, std::os::unix::fs::PermissionsExt::from_mode(0o755))
|
tokio::fs::set_permissions(dir, std::os::unix::fs::PermissionsExt::from_mode(0o755))
|
||||||
.await
|
.await
|
||||||
.map_err(|e| exec(format!("chmod {dir:?}: {e}")))?;
|
.map_err(|e| exec(format!("chmod {dir:?}: {e}")))?;
|
||||||
|
|||||||
@@ -19,12 +19,12 @@
|
|||||||
//! KVM VMs, etc.
|
//! KVM VMs, etc.
|
||||||
|
|
||||||
pub mod assets;
|
pub mod assets;
|
||||||
#[cfg(feature = "kvm")]
|
#[cfg(all(feature = "kvm", unix))]
|
||||||
pub mod libvirt_pool;
|
pub mod libvirt_pool;
|
||||||
pub mod operator;
|
pub mod operator;
|
||||||
pub mod preflight;
|
pub mod preflight;
|
||||||
mod setup_score;
|
mod setup_score;
|
||||||
#[cfg(feature = "kvm")]
|
#[cfg(all(feature = "kvm", unix))]
|
||||||
mod vm_score;
|
mod vm_score;
|
||||||
|
|
||||||
pub use assets::{
|
pub use assets::{
|
||||||
@@ -34,7 +34,7 @@ pub use assets::{
|
|||||||
UBUNTU_2404_CLOUDIMG_URL, ensure_debian_trixie_arm64_cloud_image, ensure_fleet_ssh_keypair,
|
UBUNTU_2404_CLOUDIMG_URL, ensure_debian_trixie_arm64_cloud_image, ensure_fleet_ssh_keypair,
|
||||||
ensure_ubuntu_2404_cloud_image, ensure_ubuntu_2404_cloud_image_for_arch, read_public_key,
|
ensure_ubuntu_2404_cloud_image, ensure_ubuntu_2404_cloud_image_for_arch, read_public_key,
|
||||||
};
|
};
|
||||||
#[cfg(feature = "kvm")]
|
#[cfg(all(feature = "kvm", unix))]
|
||||||
pub use libvirt_pool::{HARMONY_FLEET_POOL_NAME, HarmonyFleetPool, ensure_harmony_fleet_pool};
|
pub use libvirt_pool::{HARMONY_FLEET_POOL_NAME, HarmonyFleetPool, ensure_harmony_fleet_pool};
|
||||||
// `FleetOperatorScore` and `FleetServerScore` moved to
|
// `FleetOperatorScore` and `FleetServerScore` moved to
|
||||||
// `harmony-fleet-deploy` per ADR-023 — see that crate for the
|
// `harmony-fleet-deploy` per ADR-023 — see that crate for the
|
||||||
@@ -44,5 +44,5 @@ pub use setup_score::{
|
|||||||
AdminAuth, FleetDeviceAuth, FleetDeviceSetupConfig, FleetDeviceSetupScore, HostsEntry,
|
AdminAuth, FleetDeviceAuth, FleetDeviceSetupConfig, FleetDeviceSetupScore, HostsEntry,
|
||||||
merge_hosts_file,
|
merge_hosts_file,
|
||||||
};
|
};
|
||||||
#[cfg(feature = "kvm")]
|
#[cfg(all(feature = "kvm", unix))]
|
||||||
pub use vm_score::ProvisionVmScore;
|
pub use vm_score::ProvisionVmScore;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ use tokio::process::Command;
|
|||||||
|
|
||||||
use crate::domain::topology::VmArchitecture;
|
use crate::domain::topology::VmArchitecture;
|
||||||
use crate::executors::ExecutorError;
|
use crate::executors::ExecutorError;
|
||||||
#[cfg(feature = "kvm")]
|
#[cfg(all(feature = "kvm", unix))]
|
||||||
use crate::modules::kvm::firmware::discover_aarch64_firmware;
|
use crate::modules::kvm::firmware::discover_aarch64_firmware;
|
||||||
|
|
||||||
/// Run every preflight check for an x86_64 smoke run — equivalent
|
/// Run every preflight check for an x86_64 smoke run — equivalent
|
||||||
@@ -49,7 +49,7 @@ pub async fn check_fleet_smoke_preflight_for_arch(
|
|||||||
// without `kvm` (e.g. the on-device agent) don't pull in
|
// without `kvm` (e.g. the on-device agent) don't pull in
|
||||||
// libvirt at all; for them, aarch64 preflight simply
|
// libvirt at all; for them, aarch64 preflight simply
|
||||||
// stops after the qemu-system-aarch64 PATH check.
|
// stops after the qemu-system-aarch64 PATH check.
|
||||||
#[cfg(feature = "kvm")]
|
#[cfg(all(feature = "kvm", unix))]
|
||||||
discover_aarch64_firmware()?;
|
discover_aarch64_firmware()?;
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ pub mod http;
|
|||||||
pub mod inventory;
|
pub mod inventory;
|
||||||
pub mod k3d;
|
pub mod k3d;
|
||||||
pub mod k8s;
|
pub mod k8s;
|
||||||
#[cfg(feature = "kvm")]
|
#[cfg(all(feature = "kvm", unix))]
|
||||||
pub mod kvm;
|
pub mod kvm;
|
||||||
pub mod lamp;
|
pub mod lamp;
|
||||||
pub mod linux;
|
pub mod linux;
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
mod interpret;
|
mod interpret;
|
||||||
mod score;
|
mod score;
|
||||||
|
#[cfg(unix)]
|
||||||
mod topology;
|
mod topology;
|
||||||
|
|
||||||
pub use crate::topology::EnvVar;
|
pub use crate::topology::EnvVar;
|
||||||
pub use interpret::PodmanV0Interpret;
|
pub use interpret::PodmanV0Interpret;
|
||||||
pub use score::{PodmanService, PodmanV0Score, ReconcileScore};
|
pub use score::{PodmanService, PodmanV0Score, ReconcileScore};
|
||||||
|
#[cfg(unix)]
|
||||||
pub use topology::PodmanTopology;
|
pub use topology::PodmanTopology;
|
||||||
|
|||||||
Reference in New Issue
Block a user