Skip to content

Commit 52f5c53

Browse files
committed
continue building when a remote build fails and report errors afterwards
1 parent 1cc6e35 commit 52f5c53

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

src/cli.rs

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use std::io::{stdin, stdout, Write};
88

99
use clap::{ArgMatches, Clap, FromArgMatches};
1010
use futures_util::future::{join_all, try_join_all};
11-
use tokio::try_join;
11+
use tokio::{try_join, join};
1212

1313
use crate as deploy;
1414
use crate::push::{PushProfileData, PushProfileError};
@@ -600,9 +600,9 @@ async fn run_deploy(
600600
}
601601
});
602602

603-
try_join!(
603+
let remote_results = join!(
604604
// remote builds can be run asynchronously (per host)
605-
try_join_all(remote_build_map.into_iter().map(deploy_profiles_to_host)),
605+
join_all(remote_build_map.into_iter().map(deploy_profiles_to_host)),
606606
async {
607607
// run local builds synchronously to prevent hardware deadlocks
608608
for data in &local_builds {
@@ -614,11 +614,18 @@ async fn run_deploy(
614614
let data = data;
615615
deploy::push::push_profile(&data).await
616616
})).await;
617-
618-
Ok(())
619617
}
620-
)?;
618+
).0;
621619

620+
for result in remote_results {
621+
match result {
622+
Err((host, profile, e)) => {
623+
error!("failed building profile {} on host {}: {:?}", profile, host, e);
624+
return Err(RunDeployError::PushProfile(e));
625+
},
626+
_ => (),
627+
}
628+
}
622629

623630
let mut succeeded: Vec<(&deploy::DeployData, &deploy::DeployDefs)> = vec![];
624631

@@ -750,9 +757,9 @@ pub async fn run(args: Option<&ArgMatches>) -> Result<(), RunError> {
750757
Ok(())
751758
}
752759

753-
async fn deploy_profiles_to_host<'a>((_host, profiles): (&str, Vec<&'a PushProfileData<'a>>)) -> Result<(), PushProfileError> {
760+
async fn deploy_profiles_to_host<'a>((host, profiles): (&str, Vec<&'a PushProfileData<'a>>)) -> Result<(), (String, String, PushProfileError)> {
754761
for profile in &profiles {
755-
deploy::push::build_profile(profile).await?;
762+
deploy::push::build_profile(profile).await.map_err(|e| (host.to_string(), profile.deploy_data.profile_name.to_string(), e))?;
756763
};
757764
Ok(())
758765
}

0 commit comments

Comments
 (0)