Skip to content

Commit 85befba

Browse files
feat: add osx options
1 parent f1d156e commit 85befba

10 files changed

Lines changed: 25 additions & 17 deletions

File tree

examples/prebuilt/variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ variable "aws_region" {
2222
}
2323

2424
variable "runner_os" {
25-
description = "The EC2 Operating System type to use for action runner instances (linux,windows)."
25+
description = "The EC2 Operating System type to use for action runner instances (linux, osx, windows)."
2626

2727
type = string
2828
default = "linux"

lambdas/functions/control-plane/src/aws/runners.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ async function processFleetResult(
186186
'MaxSpotInstanceCountExceeded',
187187
'MaxSpotFleetRequestCountExceeded',
188188
'InsufficientInstanceCapacity',
189+
'InsufficientCapacityOnHost',
189190
];
190191

191192
if (

modules/multi-runner/variables.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ variable "multi_runner_config" {
179179
description = <<EOT
180180
multi_runner_config = {
181181
runner_config: {
182-
runner_os: "The EC2 Operating System type to use for action runner instances (linux,windows)."
182+
runner_os: "The EC2 Operating System type to use for action runner instances (linux, osx, windows)."
183183
runner_architecture: "The platform architecture of the runner instance_type."
184184
runner_metadata_options: "(Optional) Metadata options for the ec2 runner instances."
185185
ami: "(Optional) AMI configuration for the action runner instances. This object allows you to specify all AMI-related settings in one place."
@@ -200,7 +200,7 @@ variable "multi_runner_config" {
200200
instance_allocation_strategy: "The allocation strategy for spot instances. AWS recommends to use `capacity-optimized` however the AWS default is `lowest-price`."
201201
instance_max_spot_price: "Max price price for spot instances per hour. This variable will be passed to the create fleet as max spot price for the fleet."
202202
instance_target_capacity_type: "Default lifecycle used for runner instances, can be either `spot` or `on-demand`."
203-
instance_types: "List of instance types for the action runner. Defaults are based on runner_os (al2023 for linux and Windows Server Core for win)."
203+
description: "List of instance types for the action runner. Defaults are based on runner_os (al2023 for linux, macOS Sequoia for osx, Windows Server Core for win)."
204204
job_queue_retention_in_seconds: "The number of seconds the job is held in the queue before it is purged"
205205
minimum_running_time_in_minutes: "The time an ec2 action runner should be running at minimum before terminated if not busy."
206206
pool_runner_owner: "The pool will deploy runners to the GitHub org ID, set this value to the org to which you want the runners deployed. Repo level is not supported."

modules/runner-binaries-syncer/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
locals {
2-
action_runner_distribution_object_key = "actions-runner-${var.runner_os}.${var.runner_os == "linux" ? "tar.gz" : "zip"}"
2+
action_runner_distribution_object_key = "actions-runner-${var.runner_os}.${var.runner_os == "windows" ? "zip" : "tar.gz"}"
33
}
44

55
resource "aws_s3_bucket" "action_dist" {

modules/runner-binaries-syncer/variables.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,13 @@ variable "role_path" {
9999
}
100100

101101
variable "runner_os" {
102-
description = "The EC2 Operating System type to use for action runner instances (linux,windows)."
102+
description = "The EC2 Operating System type to use for action runner instances (linux, osx, windows)."
103103
type = string
104104
default = "linux"
105105

106106
validation {
107-
condition = contains(["linux", "windows"], var.runner_os)
108-
error_message = "Valid values for runner_os are (linux, windows)."
107+
condition = contains(["linux", "osx", "windows"], var.runner_os)
108+
error_message = "Valid values for runner_os are (linux, osx, windows)."
109109
}
110110
}
111111

modules/runners/main.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,25 @@ locals {
2020
default_ami = {
2121
"windows" = { name = ["Windows_Server-2022-English-Full-ECS_Optimized-*"] }
2222
"linux" = var.runner_architecture == "arm64" ? { name = ["al2023-ami-2023.*-kernel-6.*-arm64"] } : { name = ["al2023-ami-2023.*-kernel-6.*-x86_64"] }
23+
"osx" = var.runner_architecture == "arm64" ? { name = ["amzn-ec2-macos-15.*-arm64"] } : { name = ["amzn-ec2-macos-15.*"] }
2324
}
2425

2526
default_userdata_template = {
2627
"windows" = "${path.module}/templates/user-data.ps1"
2728
"linux" = "${path.module}/templates/user-data.sh"
29+
"osx" = "${path.module}/templates/user-data.sh"
2830
}
2931

3032
userdata_install_runner = {
3133
"windows" = "${path.module}/templates/install-runner.ps1"
3234
"linux" = "${path.module}/templates/install-runner.sh"
35+
"osx" = "${path.module}/templates/install-runner.sh"
3336
}
3437

3538
userdata_start_runner = {
3639
"windows" = "${path.module}/templates/start-runner.ps1"
3740
"linux" = "${path.module}/templates/start-runner.sh"
41+
"osx" = "${path.module}/templates/start-runner.sh"
3842
}
3943

4044
# Handle AMI configuration from either the new object or old variables

modules/runners/scale-down-state-diagram.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ stateDiagram-v2
117117
118118
note right of CheckMinimumTime
119119
Minimum running time in minutes
120-
(Linux: 5min, Windows: 15min)
120+
(Linux: 5min, Windows: 15min, OSX: 20min)
121121
end note
122122
123123
note right of CheckBootTime
@@ -145,6 +145,6 @@ stateDiagram-v2
145145
## Configuration Parameters
146146

147147
- **Cron Schedule**: `cron(*/5 * * * ? *)` (every 5 minutes)
148-
- **Minimum Runtime**: Linux 5min, Windows 15min
148+
- **Minimum Runtime**: Linux 5min, Windows 15min, OSX 20min
149149
- **Boot Timeout**: Configurable via `runner_boot_time_in_minutes`
150150
- **Idle Config**: Per-environment configuration for desired idle runners

modules/runners/scale-down.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
locals {
22
# Windows Runners can take their sweet time to do anything
3+
# For an AWS vended AMI with a x86 Mac instance or a Apple silicon Mac instance,
4+
# the launch time can range from approximately 6 minutes to 20 minutes.
35
min_runtime_defaults = {
46
"windows" = 15
57
"linux" = 5
8+
"osx" = 20
69
}
710
}
811
resource "aws_lambda_function" "scale_down" {

modules/runners/variables.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,18 +119,18 @@ variable "instance_max_spot_price" {
119119
}
120120

121121
variable "runner_os" {
122-
description = "The EC2 Operating System type to use for action runner instances (linux,windows)."
122+
description = "The EC2 Operating System type to use for action runner instances (linux, osx, windows)."
123123
type = string
124124
default = "linux"
125125

126126
validation {
127-
condition = contains(["linux", "windows"], var.runner_os)
128-
error_message = "Valid values for runner_os are (linux, windows)."
127+
condition = contains(["linux", "osx", "windows"], var.runner_os)
128+
error_message = "Valid values for runner_os are (linux, osx, windows)."
129129
}
130130
}
131131

132132
variable "instance_types" {
133-
description = "List of instance types for the action runner. Defaults are based on runner_os (al2023 for linux and Windows Server Core for win)."
133+
description = "List of instance types for the action runner. Defaults are based on runner_os (al2023 for linux, macOS Sequoia for osx, Windows Server Core for win)."
134134
type = list(string)
135135
default = null
136136
}

variables.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ variable "instance_max_spot_price" {
572572
}
573573

574574
variable "instance_types" {
575-
description = "List of instance types for the action runner. Defaults are based on runner_os (al2023 for linux and Windows Server Core for win)."
575+
description = "List of instance types for the action runner. Defaults are based on runner_os (al2023 for linux, macOS Sequoia for osx, Windows Server Core for win)."
576576
type = list(string)
577577
default = ["m5.large", "c5.large"]
578578
}
@@ -688,13 +688,13 @@ variable "enable_managed_runner_security_group" {
688688
}
689689

690690
variable "runner_os" {
691-
description = "The EC2 Operating System type to use for action runner instances (linux,windows)."
691+
description = "The EC2 Operating System type to use for action runner instances (linux, osx, windows)."
692692
type = string
693693
default = "linux"
694694

695695
validation {
696-
condition = contains(["linux", "windows"], var.runner_os)
697-
error_message = "Valid values for runner_os are (linux, windows)."
696+
condition = contains(["linux", "osx", "windows"], var.runner_os)
697+
error_message = "Valid values for runner_os are (linux, osx, windows)."
698698
}
699699
}
700700

0 commit comments

Comments
 (0)