difftreelog
feat non-interactive run0
7 files changed
Cargo.lockdiffbeforeafterboth--- a/Cargo.lock
+++ b/Cargo.lock
@@ -451,9 +451,9 @@
[[package]]
name = "bifrostlink"
-version = "0.2.6"
+version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2fb01af731c11dd31b23783a83a36a29f644cc1972481f6fa4f4fabc709079eb"
+checksum = "0c8ce9dc1425ee2aaffd3324548f114acccd456b9b1ffb33fe9eb9a7be6475a8"
dependencies = [
"async-trait",
"async_fn_traits",
@@ -465,14 +465,13 @@
"serde_json",
"tokio",
"tracing",
- "uuid",
]
[[package]]
name = "bifrostlink-macros"
-version = "0.2.6"
+version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8c4b7a5fb38b36bd81910c17ebf369f9296e508d92b1277a768a63c8a2254fdb"
+checksum = "a7d071add2d3b90486fe141edb2e811f7735155d320aee3936ebd67e535d6ac1"
dependencies = [
"proc-macro2",
"quote",
@@ -481,9 +480,9 @@
[[package]]
name = "bifrostlink-ports"
-version = "0.2.6"
+version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "977acfcb8ed3c24ab7c2f76fb3eeebff1533c72708733ce6020f2501980b7cf2"
+checksum = "ccf6ba32d0ff83b27a242f9d2fca124ad215ddd9bf99144d66b7ca44a885de50"
dependencies = [
"bifrostlink",
"bytes",
@@ -3654,13 +3653,12 @@
[[package]]
name = "remowt-client"
-version = "0.1.7"
+version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "34d59c0ce311b4b3c094b0b196a1004aa438b9947c3eace2ca4d2a0ac08fac59"
+checksum = "af0ab07d961f14fa5c4933899a5253341e2044dec71db6e341f80b16beff2c20"
dependencies = [
"anyhow",
"bifrostlink",
- "bifrostlink-ports",
"bytes",
"camino",
"futures",
@@ -3679,13 +3677,11 @@
[[package]]
name = "remowt-endpoints"
-version = "0.1.7"
+version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cb203856cd5cff27504bd2023c59195b1f1ce1cf5d8ea836598993894eb1b9c0"
+checksum = "9a841eec11d4cc0593188062634f7ee34e87a2052a70c0fa40fbecb4aa8692c0"
dependencies = [
- "anyhow",
"bifrostlink",
- "bifrostlink-macros",
"camino",
"nix",
"serde",
@@ -3693,7 +3689,6 @@
"thiserror 2.0.18",
"tokio",
"tracing",
- "uuid",
"zbus",
]
@@ -3716,9 +3711,9 @@
[[package]]
name = "remowt-link-shared"
-version = "0.1.7"
+version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "98ebba5be028a2dfb7f1858bb0ff74037262753eaae4dc6e5d9ae241c4567668"
+checksum = "d5036c5e2d5f47bb7ecb25542268f865c298c2b747d74269ff6b2b387574071a"
dependencies = [
"bifrostlink",
"bytes",
@@ -3732,9 +3727,9 @@
[[package]]
name = "remowt-plugin"
-version = "0.1.7"
+version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ef73ef3eea5bb6152d01019b5062e51ef258a1ac1c7a6f8cdcdf6fe1eb192cdd"
+checksum = "5ca599e67dc675d8dd59abfe8f08679f7f3c6fd7aa84507ab426839985a142ab"
dependencies = [
"anyhow",
"bifrostlink",
@@ -3742,7 +3737,6 @@
"remowt-link-shared",
"serde_json",
"tokio",
- "tracing",
"tracing-subscriber",
]
@@ -3757,15 +3751,14 @@
[[package]]
name = "remowt-ui-prompt"
-version = "0.1.7"
+version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "acf28ba68e6f8087657157695e9ab42b82a21130e77f6dffd27781062109325d"
+checksum = "2610933566f9b057dc47145b7bfc5876c4139eb766fc2fe9f2ce60baf1856c8c"
dependencies = [
"anyhow",
"bifrostlink",
"bifrostlink-macros",
"serde",
- "serde_json",
"thiserror 2.0.18",
"tokio",
"tracing",
cmds/fleet/src/cmds/rollback.rsdiffbeforeafterboth1use std::collections::HashSet;23use anyhow::{Result, bail};4use clap::Parser;5use fleet_base::{6 deploy::{DeployAction, deploy_task, upload_task},7 host::{Config, ConfigHost, Generation, GenerationStorage},8 opts::FleetOpts,9};10use tabled::Table;11use tracing::{info, warn};1213#[derive(Parser)]14pub struct RollbackSingle {15 machine: String,16 #[clap(subcommand)]17 action: RollbackAction,18}1920#[derive(Parser, Clone)]21struct DeployOptions {22 /// Rollback target to use23 id: String,24 /// Rollback to the current generation if rollback fails25 // Automatic rollback seems to be unnecessary for manual rollback...26 #[clap(long)]27 enable_rollback: bool,28 /// Specialization to use29 #[clap(long)]30 specialization: Option<String>,31}3233#[derive(Parser, Clone)]34enum RollbackAction {35 /// List available rollback targets36 ListTargets,37 /// Upload and execute the activation script, old version will be used after reboot.38 Test(#[clap(flatten)] DeployOptions),39 /// Upload, set current profile, and execute activation script.40 Switch(#[clap(flatten)] DeployOptions),41 /// Upload and set as current system profile, but do not execute activation script.42 Boot(#[clap(flatten)] DeployOptions),43}4445pub async fn list_all_generations(host: &ConfigHost, config: &Config) -> Vec<Generation> {46 let stored_on_machine = host47 .list_generations("system")48 .await49 .inspect_err(|e| {50 warn!("failed to list generations available on the remote machine: {e}");51 })52 .unwrap_or_default();53 let on_machine_store_paths = stored_on_machine54 .iter()55 .map(|g| &g.store_path)56 .collect::<HashSet<_>>();57 let mut stored_locally = config58 .local_host()59 .list_generations(&format!("{}-{}", config.data.gc_root_prefix, host.name))60 .await61 .inspect_err(|e| {62 warn!("failed to list generations available locally: {e}");63 })64 .unwrap_or_default();65 stored_locally.retain(|g| !on_machine_store_paths.contains(&g.store_path));66 for ele in stored_locally.iter_mut() {67 ele.current = false;68 ele.location = GenerationStorage::Deployer;69 }70 stored_locally.extend(stored_on_machine);71 stored_locally.sort_by_key(|v| v.datetime);72 stored_locally73}7475impl RollbackSingle {76 pub(crate) async fn run(&self, config: &Config, _opts: &FleetOpts) -> Result<()> {77 let host = config.host(&self.machine)?;78 match &self.action {79 RollbackAction::ListTargets => {80 let generations = list_all_generations(&host, config).await;81 if generations.is_empty() {82 bail!("no available rollback targets found");83 }84 info!("Generation list:\n{}", Table::new(&generations));85 Ok(())86 }87 RollbackAction::Boot(o) | RollbackAction::Test(o) | RollbackAction::Switch(o) => {88 let DeployOptions {89 id,90 enable_rollback,91 specialization,92 } = o;93 let action: DeployAction = match self.action {94 RollbackAction::Test { .. } => DeployAction::Test,95 RollbackAction::Switch { .. } => DeployAction::Switch,96 RollbackAction::Boot { .. } => DeployAction::Boot,97 _ => unreachable!(),98 };99 let generations = list_all_generations(&host, config).await;100 let Some(generation) = generations.iter().find(|g| &g.rollback_id() == id) else {101 bail!(102 "generation by this name is not found, existing generations:\n{}",103 Table::new(&generations)104 );105 };106 let remote_path = upload_task(107 config,108 &host,109 generation.location,110 generation.store_path.clone(),111 )112 .await?;113114 deploy_task(115 action,116 &host,117 remote_path,118 specialization.clone(),119 !*enable_rollback,120 )121 .await?;122 Ok(())123 }124 }125 }126}crates/fleet-base/src/host.rsdiffbeforeafterboth--- a/crates/fleet-base/src/host.rs
+++ b/crates/fleet-base/src/host.rs
@@ -250,7 +250,7 @@
}
let bundle = agent_bundle()?;
let conn = if self.local {
- Remowt::connect_local(&bundle)
+ Remowt::connect_local(&bundle, "remowt-fleet".to_owned())
.await
.context("starting local remowt agent")?
} else {
@@ -259,7 +259,7 @@
.get()
.cloned()
.unwrap_or_else(|| self.name.clone());
- Remowt::connect(&dest, &bundle)
+ Remowt::connect(&dest, &bundle, "remowt-fleet".to_owned())
.await
.map_err(|e| anyhow!("remowt error while connecting to {}: {e:#?}", self.name))?
};
crates/nix-eval/src/drv.rsdiffbeforeafterboth--- a/crates/nix-eval/src/drv.rs
+++ b/crates/nix-eval/src/drv.rs
@@ -104,6 +104,12 @@
.into_iter()
.map(|(k, v)| (sd.join(&k), v.outputs))
.collect();
+ let input_srcs: Vec<Utf8PathBuf> = parsed
+ .inputs
+ .srcs
+ .into_iter()
+ .map(|k| sd.join(&k))
+ .collect();
for dep_path in input_drvs.keys() {
if visited.insert(dep_path.clone()) {
@@ -122,7 +128,7 @@
DrvNode {
name: extract_drv_name(&path),
input_drvs,
- input_srcs: parsed.inputs.srcs,
+ input_srcs,
outputs,
},
);
flake.lockdiffbeforeafterboth--- a/flake.lock
+++ b/flake.lock
@@ -188,9 +188,9 @@
]
},
"locked": {
- "lastModified": 1781471358,
- "rev": "c69dddc33f8e2081ef685ae20a7278f92cfcd32e",
- "revCount": 37,
+ "lastModified": 1781491431,
+ "rev": "c8dca760c1f13e8b65677bac7b21abb487d745c0",
+ "revCount": 40,
"type": "git",
"url": "file:/home/lach/build/remowt-agents"
},
modules/nixos/module-list.nixdiffbeforeafterboth--- a/modules/nixos/module-list.nix
+++ b/modules/nixos/module-list.nix
@@ -4,5 +4,6 @@
./rollback.nix
./nix-sign.nix
./online.nix
+ ./polkit.nix
./top-level.nix
]
modules/nixos/polkit.nixdiffbeforeafterboth--- /dev/null
+++ b/modules/nixos/polkit.nix
@@ -0,0 +1,15 @@
+{ ... }:
+{
+ users.groups.fleet-pusher = { };
+
+ security.polkit.extraConfig = ''
+ polkit.addRule(function(action, subject) {
+ if (action.id == "org.freedesktop.systemd1.manage-units" && subject.isInGroup("fleet-pusher")) {
+ const unit = action.lookup("unit");
+ if (unit && unit.indexOf("remowt-fleet-") == 0) {
+ return polkit.Result.YES;
+ }
+ }
+ });
+ '';
+}