From d619f41090df95d82e8b99c2fb134727b23bf6ae Mon Sep 17 00:00:00 2001 From: Sam Sheffield Date: Mon, 23 Sep 2024 09:51:29 -0400 Subject: [PATCH] fix: add another loop to keep waiting til fully in standby, helps with enteringStandby --- .github/scripts/put-all-chain-nodes-on-standby.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/scripts/put-all-chain-nodes-on-standby.sh b/.github/scripts/put-all-chain-nodes-on-standby.sh index c84b30c50..dae5ae23f 100755 --- a/.github/scripts/put-all-chain-nodes-on-standby.sh +++ b/.github/scripts/put-all-chain-nodes-on-standby.sh @@ -19,6 +19,17 @@ do --instance-ids "$chain_node_instance_id" \ --auto-scaling-group-name "$autoscaling_group_name" \ --should-decrement-desired-capacity + + while true; do + autoscaling_group_state=$(aws autoscaling describe-auto-scaling-instances --instance-ids "$chain_node_instance_id" | jq -r '[.AutoScalingInstances | .[].LifecycleState] | join(" ")') + if [ "$autoscaling_group_state" == "Standby" ]; then + echo "instance ($chain_node_instance_id) is now in standby state" + break + else + echo "instance ($chain_node_instance_id) not in standby state yet (current state: $autoscaling_group_state), waiting 10 seconds" + sleep 10 + fi + done ;; *) echo "instance ($chain_node_instance_id) not in an elgible state ($autoscaling_group_state) for going on standby, skipping"