Skip to content

Commit 2b357bf

Browse files
authored
Merge pull request #2331 from philips-labs/develop
chore: Release
2 parents dbe4a3b + d4b7650 commit 2b357bf

File tree

21 files changed

+155
-127
lines changed

21 files changed

+155
-127
lines changed

.editorconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,13 @@
1+
# EditorConfig is awesome: https://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
16
[*]
7+
indent_style = space
8+
indent_size = 2
9+
tab_width = 2
210
end_of_line = lf
11+
charset = utf-8
12+
trim_trailing_whitespace = true
13+
insert_final_newline = true

.vscode/extensions.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
66
"editorconfig.editorconfig",
77
"yzhang.markdown-all-in-one",
8-
"sonarsource.sonarlint-vscode",
98
"hashicorp.terraform"
109
]
1110
}

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,8 +309,7 @@ The example for [ephemeral runners](./examples/ephemeral) is based on the [defau
309309

310310
### Prebuilt Images
311311

312-
This module also allows you to run agents from a prebuilt AMI to gain faster startup times. You can find more information in [the image README.md](/images/README.md)
313-
312+
This module also allows you to run agents from a prebuilt AMI to gain faster startup times. You can find more information in [the image README.md](/images/README.md). When the GitHub runner is part of the AMI you can disable the binary syncer by setting `enable_runner_binaries_syncer = false`.
314313

315314
## Examples
316315

@@ -407,6 +406,7 @@ In case the setup does not work as intended follow the trace of events:
407406
| <a name="input_enable_job_queued_check"></a> [enable\_job\_queued\_check](#input\_enable\_job\_queued\_check) | Only scale if the job event received by the scale up lambda is is in the state queued. By default enabled for non ephemeral runners and disabled for ephemeral. Set this variable to overwrite the default behavior. | `bool` | `null` | no |
408407
| <a name="input_enable_managed_runner_security_group"></a> [enable\_managed\_runner\_security\_group](#input\_enable\_managed\_runner\_security\_group) | Enabling the default managed security group creation. Unmanaged security groups can be specified via `runner_additional_security_group_ids`. | `bool` | `true` | no |
409408
| <a name="input_enable_organization_runners"></a> [enable\_organization\_runners](#input\_enable\_organization\_runners) | Register runners to organization, instead of repo level | `bool` | `false` | no |
409+
| <a name="input_enable_runner_binaries_syncer"></a> [enable\_runner\_binaries\_syncer](#input\_enable\_runner\_binaries\_syncer) | Option to disable the lambda to sync GitHub runner distribution, usefull when using a pre-build AMI. | `bool` | `true` | no |
410410
| <a name="input_enable_runner_detailed_monitoring"></a> [enable\_runner\_detailed\_monitoring](#input\_enable\_runner\_detailed\_monitoring) | Should detailed monitoring be enabled for the runner. Set this to true if you want to use detailed monitoring. See https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-cloudwatch-new.html for details. | `bool` | `false` | no |
411411
| <a name="input_enable_ssm_on_runners"></a> [enable\_ssm\_on\_runners](#input\_enable\_ssm\_on\_runners) | Enable to allow access the runner instances for debugging purposes via SSM. Note that this adds additional permissions to the runner instances. | `bool` | `false` | no |
412412
| <a name="input_enabled_userdata"></a> [enabled\_userdata](#input\_enabled\_userdata) | Should the userdata script be enabled for the runner. Set this to false if you are using your own prebuilt AMI. | `bool` | `true` | no |

examples/prebuilt/README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Action runners deployment with prebuilt image
22

3-
This module shows how to create GitHub action runners using a prebuilt AMI for the runners
3+
This module shows how to create GitHub action runners using a prebuilt AMI for the runners.
4+
5+
- Configured to run with org level runners.
6+
- GitHub runner binary syncer is not deployed.
47

58
## Usages
69

@@ -56,7 +59,7 @@ module "runners" {
5659
...
5760
# set the name of the ami to use
5861
ami_filter = { name = ["github-runner-amzn2-x86_64-2021*"] }
59-
# provide the owner id of
62+
# provide the owner id of
6063
ami_owners = ["<your owner id>"]
6164
6265
enabled_userdata = false

examples/prebuilt/main.tf

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ module "runners" {
1515
vpc_id = module.vpc.vpc_id
1616
subnet_ids = module.vpc.private_subnets
1717

18-
prefix = local.environment
18+
prefix = local.environment
19+
enable_organization_runners = false
1920

2021
github_app = {
2122
key_base64 = var.github_app_key_base64
@@ -36,6 +37,9 @@ module "runners" {
3637
ami_filter = { name = [var.ami_name_filter] }
3738
ami_owners = [data.aws_caller_identity.current.account_id]
3839

40+
# disable binary syncer since github agent is already installed in the AMI.
41+
enable_runner_binaries_syncer = false
42+
3943
# enable access to the runners via SSM
4044
enable_ssm_on_runners = true
4145

examples/prebuilt/outputs.tf

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
output "runners" {
2-
value = {
3-
lambda_syncer_name = module.runners.binaries_syncer.lambda.function_name
4-
}
5-
}
6-
71
output "webhook_endpoint" {
82
value = module.runners.webhook.endpoint
93
}

examples/ubuntu/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ module "runners" {
4646
ami_owners = ["099720109477"] # Canonical's Amazon account ID
4747

4848
ami_filter = {
49-
name = ["ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-*"]
49+
name = ["ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-amd64-server-*"]
5050
}
5151

5252
# Custom build AMI, no custom userdata needed.

examples/ubuntu/templates/user-data.sh

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@ ${pre_install}
77
apt-get update
88
DEBIAN_FRONTEND=noninteractive apt-get install -y \
99
awscli \
10-
jq \
10+
build-essential \
1111
curl \
12-
wget \
1312
git \
13+
iptables \
14+
jq \
1415
uidmap \
15-
build-essential \
16-
unzip
16+
unzip \
17+
wget
1718

1819
user_name=ubuntu
1920
user_id=$(id -ru $user_name)
@@ -43,16 +44,16 @@ WantedBy=default.target
4344
4445
EOF
4546

46-
echo export XDG_RUNTIME_DIR=/run/user/$user_id >>/home/$user_name/.profile
47+
echo export XDG_RUNTIME_DIR=/run/user/$user_id >>/home/$user_name/.bashrc
4748

4849
systemctl daemon-reload
4950
systemctl enable [email protected]
5051
systemctl start [email protected]
5152

5253
curl -fsSL https://get.docker.com/rootless >>/opt/rootless.sh && chmod 755 /opt/rootless.sh
5354
su -l $user_name -c /opt/rootless.sh
54-
echo export DOCKER_HOST=unix:///run/user/$user_id/docker.sock >>/home/$user_name/.profile
55-
echo export PATH=/home/$user_name/bin:$PATH >>/home/$user_name/.profile
55+
echo export DOCKER_HOST=unix:///run/user/$user_id/docker.sock >>/home/$user_name/.bashrc
56+
echo export PATH=/home/$user_name/bin:$PATH >>/home/$user_name/.bashrc
5657

5758
# Run docker service by default
5859
loginctl enable-linger $user_name

images/linux-amzn2/github_agent.linux.pkr.hcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ packer {
1010
variable "runner_version" {
1111
description = "The version (no v prefix) of the runner software to install https://github.com/actions/runner/releases"
1212
type = string
13-
default = "2.286.1"
13+
default = "2.295.0"
1414
}
1515

1616
variable "region" {

main.tf

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ locals {
33
"ghr:environment" = var.prefix
44
})
55

6-
s3_action_runner_url = "s3://${module.runner_binaries.bucket.id}/${module.runner_binaries.runner_distribution_object_key}"
76
github_app_parameters = {
87
id = module.ssm.parameters.github_app_id
98
key_base64 = module.ssm.parameters.github_app_key_base64
@@ -134,8 +133,11 @@ module "runners" {
134133
prefix = var.prefix
135134
tags = local.tags
136135

137-
s3_bucket_runner_binaries = module.runner_binaries.bucket
138-
s3_location_runner_binaries = local.s3_action_runner_url
136+
s3_runner_binaries = var.enable_runner_binaries_syncer ? {
137+
arn = module.runner_binaries[0].bucket.arn
138+
id = module.runner_binaries[0].bucket.id
139+
key = module.runner_binaries[0].runner_distribution_object_key
140+
} : null
139141

140142
runner_os = var.runner_os
141143
instance_types = var.instance_types
@@ -169,6 +171,7 @@ module "runners" {
169171
runner_additional_security_group_ids = var.runner_additional_security_group_ids
170172
metadata_options = var.runner_metadata_options
171173

174+
enable_runner_binaries_syncer = var.enable_runner_binaries_syncer
172175
lambda_s3_bucket = var.lambda_s3_bucket
173176
runners_lambda_s3_key = var.runners_lambda_s3_key
174177
runners_lambda_s3_object_version = var.runners_lambda_s3_object_version
@@ -218,6 +221,8 @@ module "runners" {
218221
}
219222

220223
module "runner_binaries" {
224+
count = var.enable_runner_binaries_syncer ? 1 : 0
225+
221226
source = "./modules/runner-binaries-syncer"
222227

223228
aws_region = var.aws_region

0 commit comments

Comments
 (0)