Skip to content

Commit fe097e9

Browse files
authored
Retry allocation in multiple zones/regions if there is no capacity (#231)
* add ability to specify multiple availability zones * add multi-region support to the availability zone spec * do best effort to remove ec2 instance if there is no runner label * add default startup timeout * fix parsing of gh timeout config
1 parent 9bf18bd commit fe097e9

File tree

6 files changed

+338
-107
lines changed

6 files changed

+338
-107
lines changed

action.yml

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,20 @@ inputs:
1515
description: >-
1616
GitHub Personal Access Token with the 'repo' scope assigned.
1717
required: true
18+
availability-zones-config:
19+
description: >-
20+
JSON string array of objects with configurations for multiple availability zones.
21+
Each object should contain 'imageId', 'subnetId', and 'securityGroupId'.
22+
Optionally, you can specify 'region' to launch the instance in a specific AWS region.
23+
If 'region' is not specified, the default AWS_REGION environment variable will be used.
24+
Example: '[{"imageId":"ami-123","subnetId":"subnet-123","securityGroupId":"sg-123"},{"imageId":"ami-456","subnetId":"subnet-456","securityGroupId":"sg-456","region":"us-west-2"}]'
25+
When provided, the action will try each configuration in sequence until a successful instance is launched.
26+
This takes precedence over individual ec2-image-id, subnet-id, and security-group-id parameters.
27+
required: false
1828
ec2-image-id:
1929
description: >-
2030
EC2 Image Id (AMI). The new runner will be launched from this image.
21-
This input is required if you use the 'start' mode.
31+
This input is required if you use the 'start' mode and don't provide availability-zones-config.
2232
required: false
2333
ec2-instance-type:
2434
description: >-
@@ -28,14 +38,14 @@ inputs:
2838
subnet-id:
2939
description: >-
3040
VPC Subnet Id. The subnet should belong to the same VPC as the specified security group.
31-
This input is required if you use the 'start' mode.
41+
This input is required if you use the 'start' mode and don't provide availability-zones-config.
3242
required: false
3343
security-group-id:
3444
description: >-
3545
EC2 Security Group Id.
3646
The security group should belong to the same VPC as the specified subnet.
3747
The runner doesn't require any inbound traffic. However, outbound traffic should be allowed.
38-
This input is required if you use the 'start' mode.
48+
This input is required if you use the 'start' mode and don't provide availability-zones-config.
3949
required: false
4050
label:
4151
description: >-
@@ -88,17 +98,20 @@ inputs:
8898
description: >-
8999
Specifies the retry interval in seconds to register the runner after the quiet period.
90100
required: false
91-
startup-timeout-seconds:
101+
startup-timeout-minutes:
92102
description: >-
93-
Specifies the timeout in seconds to register the runner after the quiet period.
103+
Specifies the timeout in minutes to register the runner after the quiet period.
104+
required: false
105+
default: '5'
94106
run-runner-as-service:
95-
type: boolean
96107
description: >-
97108
Start the runner as a service rather than using ./run.sh as root.
98109
required: false
110+
default: 'false'
99111
run-runner-as-user:
100112
description: >-
101113
Specify user under whom the runner service should run
114+
required: false
102115
ec2-volume-size:
103116
description: >-
104117
EC2 volume size in GB.
@@ -124,6 +137,10 @@ outputs:
124137
description: >-
125138
EC2 Instance Id of the created runner.
126139
The id is used to terminate the EC2 instance when the runner is not needed anymore.
140+
region:
141+
description: >-
142+
AWS region where the EC2 instance was created.
143+
This is useful for subsequent AWS operations on the instance.
127144
runs:
128145
using: node20
129146
main: ./dist/index.js

0 commit comments

Comments
 (0)