aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authornotgne22020-10-23 22:44:52 -0700
committernotgne22020-10-23 22:44:52 -0700
commit72b066b293befec048f6a1b2f8d7a4b103ae4edf (patch)
tree620f9ff02ef16b0a6f45968a533b2c6ceb14bb93 /src/main.rs
parent4084e0516d3903acd80ca465f9906e5d3bce2659 (diff)
Add an option to keep build results
Diffstat (limited to '')
-rw-r--r--src/main.rs27
1 files changed, 24 insertions, 3 deletions
diff --git a/src/main.rs b/src/main.rs
index 5d76e3d..1358a83 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -33,6 +33,13 @@ struct Opts {
/// Extra arguments to be passed to nix build
extra_build_args: Vec<String>,
+ /// Keep the build outputs of each built profile
+ #[clap(short, long)]
+ keep_result: bool,
+ /// Location to keep outputs from built profiles in
+ #[clap(short, long)]
+ result_path: Option<String>,
+
/// Override the SSH user with the given value
#[clap(long)]
ssh_user: Option<String>,
@@ -71,6 +78,8 @@ async fn push_all_profiles(
top_settings: &utils::data::GenericSettings,
check_sigs: bool,
cmd_overrides: &utils::CmdOverrides,
+ keep_result: bool,
+ result_path: Option<&str>,
) -> Result<(), Box<dyn std::error::Error>> {
info!("Pushing all profiles for `{}`", node_name);
@@ -115,6 +124,8 @@ async fn push_all_profiles(
repo,
&deploy_data,
&deploy_defs,
+ keep_result,
+ result_path,
)
.await?;
}
@@ -221,9 +232,7 @@ async fn get_deployment_data(
build_command = build_command.arg(extra_arg);
}
- let build_child = build_command
- .stdout(Stdio::piped())
- .spawn()?;
+ let build_child = build_command.stdout(Stdio::piped()).spawn()?;
let build_output = build_child.wait_with_output().await?;
@@ -245,6 +254,8 @@ async fn run_deploy(
supports_flakes: bool,
check_sigs: bool,
cmd_overrides: utils::CmdOverrides,
+ keep_result: bool,
+ result_path: Option<&str>,
) -> Result<(), Box<dyn std::error::Error>> {
match (deploy_flake.node, deploy_flake.profile) {
(Some(node_name), Some(profile_name)) => {
@@ -274,6 +285,8 @@ async fn run_deploy(
deploy_flake.repo,
&deploy_data,
&deploy_defs,
+ keep_result,
+ result_path,
)
.await?;
@@ -293,6 +306,8 @@ async fn run_deploy(
&data.generic_settings,
check_sigs,
&cmd_overrides,
+ keep_result,
+ result_path,
)
.await?;
@@ -310,6 +325,8 @@ async fn run_deploy(
&data.generic_settings,
check_sigs,
&cmd_overrides,
+ keep_result,
+ result_path,
)
.await?;
}
@@ -360,12 +377,16 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
let data =
get_deployment_data(supports_flakes, deploy_flake.repo, &opts.extra_build_args).await?;
+ let result_path = opts.result_path.as_deref();
+
run_deploy(
deploy_flake,
data,
supports_flakes,
opts.checksigs,
cmd_overrides,
+ opts.keep_result,
+ result_path,
)
.await?;