mirror of
https://github.com/serokell/deploy-rs.git
synced 2024-11-22 22:44:39 +03:00
Add skip-push flag
This commit is contained in:
parent
aabcf6b77d
commit
3a92593bf9
@ -71,11 +71,11 @@
|
||||
},
|
||||
"nixpkgs_3": {
|
||||
"locked": {
|
||||
"lastModified": 1592491430,
|
||||
"narHash": "sha256-7WNpr16iUyjG4caad137nCqxXNTdct202jy05lslZXA=",
|
||||
"lastModified": 1601994071,
|
||||
"narHash": "sha256-J1TNrQI3Gb5Yl9b4+O6eh1Zp1ha4YhI7ewsN1M/9x68=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "07299ff81e58e16b282fe602ce5e629854dfd544",
|
||||
"rev": "6f90e1df4f27326c52b805cfd01fc79a49208e5c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
61
src/main.rs
61
src/main.rs
@ -51,6 +51,9 @@ struct Opts {
|
||||
/// Override hostname used for the node
|
||||
#[clap(long)]
|
||||
hostname: Option<String>,
|
||||
/// Skip pushing step (useful for local testing)
|
||||
#[clap(short, long)]
|
||||
skip_push: bool,
|
||||
}
|
||||
|
||||
#[inline]
|
||||
@ -235,6 +238,7 @@ async fn run_deploy(
|
||||
data: utils::data::Data,
|
||||
supports_flakes: bool,
|
||||
check_sigs: bool,
|
||||
skip_push: bool,
|
||||
cmd_overrides: utils::CmdOverrides,
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
match (deploy_flake.node, deploy_flake.profile) {
|
||||
@ -259,14 +263,16 @@ async fn run_deploy(
|
||||
|
||||
let deploy_defs = deploy_data.defs();
|
||||
|
||||
utils::push::push_profile(
|
||||
supports_flakes,
|
||||
check_sigs,
|
||||
deploy_flake.repo,
|
||||
&deploy_data,
|
||||
&deploy_defs,
|
||||
)
|
||||
.await?;
|
||||
if !skip_push {
|
||||
utils::push::push_profile(
|
||||
supports_flakes,
|
||||
check_sigs,
|
||||
deploy_flake.repo,
|
||||
&deploy_data,
|
||||
&deploy_defs,
|
||||
)
|
||||
.await?;
|
||||
}
|
||||
|
||||
utils::deploy::deploy_profile(&deploy_data, &deploy_defs).await?;
|
||||
}
|
||||
@ -276,23 +282,7 @@ async fn run_deploy(
|
||||
None => good_panic!("No node was found named `{}`", node_name),
|
||||
};
|
||||
|
||||
push_all_profiles(
|
||||
node,
|
||||
node_name,
|
||||
supports_flakes,
|
||||
deploy_flake.repo,
|
||||
&data.generic_settings,
|
||||
check_sigs,
|
||||
&cmd_overrides,
|
||||
)
|
||||
.await?;
|
||||
|
||||
deploy_all_profiles(node, node_name, &data.generic_settings, &cmd_overrides).await?;
|
||||
}
|
||||
(None, None) => {
|
||||
info!("Deploying all profiles on all nodes");
|
||||
|
||||
for (node_name, node) in &data.nodes {
|
||||
if !skip_push {
|
||||
push_all_profiles(
|
||||
node,
|
||||
node_name,
|
||||
@ -305,6 +295,26 @@ async fn run_deploy(
|
||||
.await?;
|
||||
}
|
||||
|
||||
deploy_all_profiles(node, node_name, &data.generic_settings, &cmd_overrides).await?;
|
||||
}
|
||||
(None, None) => {
|
||||
info!("Deploying all profiles on all nodes");
|
||||
|
||||
if !skip_push {
|
||||
for (node_name, node) in &data.nodes {
|
||||
push_all_profiles(
|
||||
node,
|
||||
node_name,
|
||||
supports_flakes,
|
||||
deploy_flake.repo,
|
||||
&data.generic_settings,
|
||||
check_sigs,
|
||||
&cmd_overrides,
|
||||
)
|
||||
.await?;
|
||||
}
|
||||
}
|
||||
|
||||
for (node_name, node) in &data.nodes {
|
||||
deploy_all_profiles(node, node_name, &data.generic_settings, &cmd_overrides)
|
||||
.await?;
|
||||
@ -363,6 +373,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
data,
|
||||
supports_flakes,
|
||||
opts.checksigs,
|
||||
opts.skip_push,
|
||||
cmd_overrides,
|
||||
)
|
||||
.await?;
|
||||
|
Loading…
Reference in New Issue
Block a user