Skip to content
This repository was archived by the owner on Apr 18, 2025. It is now read-only.

Commit 93bc24e

Browse files
authored
Feat/ci fix (#1101)
* CI-fix * Update wakeUpRunner.sh * Update wakeUpRunner.sh
1 parent 913800e commit 93bc24e

File tree

2 files changed

+33
-25
lines changed

2 files changed

+33
-25
lines changed
Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,47 @@
11
#!/bin/bash
22

33
profile="cirunner"
4-
runner_vpc_id1="vpc-8bdf97ec"
5-
runner_vpc_id2="vpc-1176d875"
4+
runner_vpc_id="vpc-0323d32f82edcdec7"
65
region_opt="--region us-west-2"
76

87
# Get runner status
9-
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)
10-
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)
8+
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)
9+
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)
1110

12-
{
13-
while true; do
11+
# start runner1
12+
while true; do
13+
runner_status=$(aws ec2 describe-instances --profile $profile --instance-ids $runner1 --query "Reservations[*].Instances[*].State.[Name]" ${region_opt} --output text)
14+
echo 'runner1 - '$runner_status
15+
if [[ $runner_status = "stopped" ]]; then
16+
aws ec2 start-instances --profile $profile --instance-ids $runner1 ${region_opt}
17+
break
18+
elif [[ $runner_status = "running" ]]; then
19+
echo 'waiting for runner1 restore'
20+
sleep 30
1421
runner_status=$(aws ec2 describe-instances --profile $profile --instance-ids $runner1 --query "Reservations[*].Instances[*].State.[Name]" ${region_opt} --output text)
15-
echo 'runner1 - '$runner_status
16-
if [[ $runner_status = "stopped" ]]; then
17-
aws ec2 start-instances --profile $profile --instance-ids $runner1 ${region_opt}
22+
if [[ $runner_status = "running" ]]; then
1823
break
19-
elif [[ $runner_status = "running" ]]; then
20-
echo 'waiting for runner1 restore'
21-
sleep 30
22-
runner_status=$(aws ec2 describe-instances --profile $profile --instance-ids $runner1 --query "Reservations[*].Instances[*].State.[Name]" ${region_opt} --output text)
23-
if [[ $runner_status = "running" ]]; then
24-
break
25-
fi
26-
else
27-
sleep 30
2824
fi
29-
done
30-
}&
25+
else
26+
sleep 30
27+
fi
28+
done
29+
30+
# start runner2
3131
while true; do
32-
runner_status=$(aws ec2 describe-instances --profile $profile --instance-ids $runner2 --query "Reservations[*].Instances[*].State.[Name]" --output text)
32+
runner_status=$(aws ec2 describe-instances --profile $profile --instance-ids $runner2 --query "Reservations[*].Instances[*].State.[Name]" ${region_opt} --output text)
3333
echo 'runner2 - '$runner_status
3434
if [[ $runner_status = "stopped" ]]; then
35-
aws ec2 start-instances --profile $profile --instance-ids $runner2
35+
aws ec2 start-instances --profile $profile --instance-ids $runner2 ${region_opt}
3636
break
3737
elif [[ $runner_status = "running" ]]; then
3838
echo 'waiting for runner2 restore'
3939
sleep 30
40-
runner_status=$(aws ec2 describe-instances --profile $profile --instance-ids $runner2 --query "Reservations[*].Instances[*].State.[Name]" --output text)
40+
runner_status=$(aws ec2 describe-instances --profile $profile --instance-ids $runner2 --query "Reservations[*].Instances[*].State.[Name]" ${region_opt} --output text)
4141
if [[ $runner_status = "running" ]]; then
4242
break
4343
fi
4444
else
4545
sleep 30
4646
fi
4747
done
48-
49-
exit 0

.github/workflows/select-runner.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,13 @@ jobs:
3838
outputs:
3939
matrix1: ${{ toJSON( fromJSON(inputs.matrices)[1] ) }}
4040
matrix2: ${{ toJSON( fromJSON(inputs.matrices)[2] ) }}
41+
42+
wakeup:
43+
name: Wake up self-hosted runner
44+
if: ${{ inputs.enabled }}
45+
needs: [select]
46+
runs-on: ${{ inputs.bastion-host }}
47+
concurrency: ${{ needs.select.outputs.matrix1 }}
48+
steps:
49+
- uses: actions/checkout@v4
50+
- run: .github/ciChecksScripts/wakeUpRunner.sh

0 commit comments

Comments
 (0)