From 873d9ea433a09d854ad0fefbcd8d94b90530f114 Mon Sep 17 00:00:00 2001 From: mbecker20 Date: Wed, 29 May 2024 00:16:55 -0700 Subject: [PATCH] builder instance failed reachability adds log that instance will be terminated --- bin/core/src/api/execute/build.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bin/core/src/api/execute/build.rs b/bin/core/src/api/execute/build.rs index 7038cae22..d36f168a0 100644 --- a/bin/core/src/api/execute/build.rs +++ b/bin/core/src/api/execute/build.rs @@ -495,6 +495,8 @@ async fn get_aws_builder( tokio::time::sleep(Duration::from_secs(BUILDER_POLL_RATE_SECS)) .await; } + + // Spawn terminate task in failure case (if loop is passed without return) tokio::spawn(async move { let _ = terminate_ec2_instance_with_retry(config.region, &instance_id) @@ -502,7 +504,11 @@ async fn get_aws_builder( }); // Unwrap is safe, only way to get here is after check Ok / early return, so it must be err - Err(res.err().unwrap()) + Err( + res.err().unwrap().context( + "failed to start usable builder. terminating instance.", + ), + ) } #[instrument(skip(periphery, update))]