From b576610efda12afbbf77b8d1be9d4eaaf6d23f8f Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Wed, 15 Jul 2026 20:25:16 +0100 Subject: [PATCH] Give Idunn ownership of Yggdrasil VoidBot releases --- src/main.rs | 63 +++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 52 insertions(+), 11 deletions(-) diff --git a/src/main.rs b/src/main.rs index d966eef..715caac 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2079,6 +2079,23 @@ fn swarm_targets(options: &SwarmOptions) -> Result> { match options.profile.as_str() { "yggdrasil-local" => Ok(vec![ + DaemonTarget { + daemon_id: "yggdrasil-voidbot".to_string(), + verse_id: "yggdrasil.local".to_string(), + name: "Yggdrasil VoidBot".to_string(), + health_contract: health_contract("voidbot.cultnet-rudp-stack-health", "failed"), + deploy_command: Some(yggdrasil_actuator("deploy", "voidbot")), + restart_command: Some(yggdrasil_actuator("restart", "voidbot")), + release: Some(release_target( + "VoidBot", + PathBuf::from("/srv/build/VoidBot"), + "restart-after-verified-build", + None, + "restart-required", + )), + enabled: true, + interval_seconds: 300, + }, DaemonTarget { daemon_id: "yggdrasil-heimdall".to_string(), verse_id: "yggdrasil.local".to_string(), @@ -2185,17 +2202,6 @@ fn swarm_targets(options: &SwarmOptions) -> Result> { enabled: true, interval_seconds: 30, }, - DaemonTarget { - daemon_id: "voidbot".to_string(), - verse_id: "starfire.local".to_string(), - name: "VoidBot local stack".to_string(), - health_contract: health_contract("voidbot.cultnet-rudp-stack-health", "failed"), - deploy_command: None, - restart_command: Some(script("restart-voidbot.cmd")), - release: None, - enabled: true, - interval_seconds: 300, - }, DaemonTarget { daemon_id: "weksa".to_string(), verse_id: "starfire.local".to_string(), @@ -3815,6 +3821,41 @@ mod tests { ); } + #[test] + fn voidbot_release_authority_is_yggdrasil_local_only() { + let yggdrasil = swarm_targets(&SwarmOptions { + profile: "yggdrasil-local".to_string(), + repo_root: PathBuf::from("/srv/odin/source"), + }) + .expect("yggdrasil-local targets"); + let voidbot = yggdrasil + .iter() + .find(|target| target.daemon_id == "yggdrasil-voidbot") + .expect("Yggdrasil VoidBot target"); + + assert_eq!(voidbot.verse_id, "yggdrasil.local"); + assert_eq!( + voidbot.deploy_command.as_deref(), + Some("sudo -n /usr/local/libexec/idunn-yggdrasil deploy voidbot") + ); + assert_eq!( + voidbot.restart_command.as_deref(), + Some("sudo -n /usr/local/libexec/idunn-yggdrasil restart voidbot") + ); + let release = voidbot.release.as_ref().expect("VoidBot release target"); + assert_eq!(release.repo_path, PathBuf::from("/srv/build/VoidBot")); + assert_eq!(release.upstream_remote, "origin"); + assert_eq!(release.upstream_branch, "main"); + + let starfire = swarm_targets(&SwarmOptions { + profile: "starfire-local".to_string(), + repo_root: PathBuf::from("E:/Projects/Odin"), + }) + .expect("starfire-local targets"); + assert!(starfire.iter().all(|target| target.daemon_id != "voidbot" + && target.daemon_id != "yggdrasil-voidbot")); + } + #[test] fn starfire_and_nightwing_muninn_restart_when_health_publication_is_missing() { let options = SwarmOptions {