forked from scroll-tech/zkevm-circuits
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* CI-fix * Update wakeUpRunner.sh * Update wakeUpRunner.sh * Update select-runner.yml --------- Co-authored-by: 张三 <[email protected]>
- Loading branch information
1 parent
1e95486
commit 734d84b
Showing
2 changed files
with
33 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,47 @@ | ||
#!/bin/bash | ||
|
||
profile="cirunner" | ||
runner_vpc_id1="vpc-8bdf97ec" | ||
runner_vpc_id2="vpc-1176d875" | ||
runner_vpc_id="vpc-0323d32f82edcdec7" | ||
region_opt="--region us-west-2" | ||
|
||
# Get runner status | ||
runner1=$(aws ec2 describe-instances --profile $profile --filters Name=tag:Name,Values=[jenkins] Name=network-interface.vpc-id,Values=[$runner_vpc_id1] --query "Reservations[*].Instances[*][InstanceId]" ${region_opt} --output text | xargs) | ||
runner2=$(aws ec2 describe-instances --profile $profile --filters Name=tag:Name,Values=[jenkins] Name=network-interface.vpc-id,Values=[$runner_vpc_id2] --query "Reservations[*].Instances[*][InstanceId]" --output text | xargs) | ||
runner1=$(aws ec2 describe-instances --profile $profile --filters Name=tag:Name,Values=[super1] Name=network-interface.vpc-id,Values=[$runner_vpc_id] --query "Reservations[*].Instances[*][InstanceId]" ${region_opt} --output text | xargs) | ||
runner2=$(aws ec2 describe-instances --profile $profile --filters Name=tag:Name,Values=[super2] Name=network-interface.vpc-id,Values=[$runner_vpc_id] --query "Reservations[*].Instances[*][InstanceId]" ${region_opt} --output text | xargs) | ||
|
||
{ | ||
while true; do | ||
# start runner1 | ||
while true; do | ||
runner_status=$(aws ec2 describe-instances --profile $profile --instance-ids $runner1 --query "Reservations[*].Instances[*].State.[Name]" ${region_opt} --output text) | ||
echo 'runner1 - '$runner_status | ||
if [[ $runner_status = "stopped" ]]; then | ||
aws ec2 start-instances --profile $profile --instance-ids $runner1 ${region_opt} | ||
break | ||
elif [[ $runner_status = "running" ]]; then | ||
echo 'waiting for runner1 restore' | ||
sleep 30 | ||
runner_status=$(aws ec2 describe-instances --profile $profile --instance-ids $runner1 --query "Reservations[*].Instances[*].State.[Name]" ${region_opt} --output text) | ||
echo 'runner1 - '$runner_status | ||
if [[ $runner_status = "stopped" ]]; then | ||
aws ec2 start-instances --profile $profile --instance-ids $runner1 ${region_opt} | ||
if [[ $runner_status = "running" ]]; then | ||
break | ||
elif [[ $runner_status = "running" ]]; then | ||
echo 'waiting for runner1 restore' | ||
sleep 30 | ||
runner_status=$(aws ec2 describe-instances --profile $profile --instance-ids $runner1 --query "Reservations[*].Instances[*].State.[Name]" ${region_opt} --output text) | ||
if [[ $runner_status = "running" ]]; then | ||
break | ||
fi | ||
else | ||
sleep 30 | ||
fi | ||
done | ||
}& | ||
else | ||
sleep 30 | ||
fi | ||
done | ||
|
||
# start runner2 | ||
while true; do | ||
runner_status=$(aws ec2 describe-instances --profile $profile --instance-ids $runner2 --query "Reservations[*].Instances[*].State.[Name]" --output text) | ||
runner_status=$(aws ec2 describe-instances --profile $profile --instance-ids $runner2 --query "Reservations[*].Instances[*].State.[Name]" ${region_opt} --output text) | ||
echo 'runner2 - '$runner_status | ||
if [[ $runner_status = "stopped" ]]; then | ||
aws ec2 start-instances --profile $profile --instance-ids $runner2 | ||
aws ec2 start-instances --profile $profile --instance-ids $runner2 ${region_opt} | ||
break | ||
elif [[ $runner_status = "running" ]]; then | ||
echo 'waiting for runner2 restore' | ||
sleep 30 | ||
runner_status=$(aws ec2 describe-instances --profile $profile --instance-ids $runner2 --query "Reservations[*].Instances[*].State.[Name]" --output text) | ||
runner_status=$(aws ec2 describe-instances --profile $profile --instance-ids $runner2 --query "Reservations[*].Instances[*].State.[Name]" ${region_opt} --output text) | ||
if [[ $runner_status = "running" ]]; then | ||
break | ||
fi | ||
else | ||
sleep 30 | ||
fi | ||
done | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters