Skip to content

Commit 74533c8

Browse files
committed
Merge branch 'release/0.3.0'
2 parents ee58586 + 7d2b65d commit 74533c8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+2700
-2274
lines changed

.ci/build.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#!/usr/bin/env bash
22

3-
lambaSrcDirs=("modules/runner-binaries-syncer/lambdas/runner-binaries-syncer" "modules/runners/lambdas/scale-runners" "modules/webhook/lambdas/webhook")
4-
repoRoot=$(dirname "${BASH_SOURCE[0]}")/..
3+
lambdaSrcDirs=("modules/runner-binaries-syncer/lambdas/runner-binaries-syncer" "modules/runners/lambdas/runners" "modules/webhook/lambdas/webhook")
4+
repoRoot=$(dirname $(dirname $(realpath ${BASH_SOURCE[0]})))
55

6-
for lambdaDir in ${lambaSrcDirs[@]}; do
7-
cd $repoRoot/${lambdaDir}
6+
for lambdaDir in ${lambdaSrcDirs[@]}; do
7+
cd "$repoRoot/${lambdaDir}"
88
docker build -t lambda -f ../../../../.ci/Dockerfile .
99
docker create --name lambda lambda
1010
zipName=$(basename "$PWD")

.github/workflows/lambda-runner-binaries-syncer.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
push:
77
branches:
88
- master
9+
- develop
910
pull_request:
1011
paths:
1112
- .github/workflows/lambda-runner-binaries-syncer.yml

.github/workflows/lambda-runners.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ on:
33
push:
44
branches:
55
- master
6+
- develop
67
pull_request:
78
paths:
89
- .github/workflows/lambda-runners.yml

.github/workflows/lambda-webhook.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ on:
33
push:
44
branches:
55
- master
6+
- develop
67
pull_request:
78
paths:
89
- .github/workflows/lambda-webhook.yml

.github/workflows/terraform.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ on:
33
push:
44
branches:
55
- master
6+
- develop
67
pull_request:
78
paths-ignore:
89
- "modules/*/lambdas/**"

CHANGELOG.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,20 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

88
## [Unreleased]
9-
- Added the ability to pass in pre and post install scripts to the userdata script for the EC2 instances
9+
10+
## [0.3.0] - 2020-08-06
11+
12+
### Added
13+
14+
- feat: Add support for ARM64 runners #102 @bdruth
15+
- feat: added variables in the root module to allow passing in pre and and post install #45 @jaydenrasmussen
16+
17+
### Updated
18+
19+
- fix: Build script not entering all the module directories (#103) @alonsohki
20+
- fix: Remove Orphan AWS runners (#79)
21+
- fix: documentation for downloading lambdas (#78) @@bendavies
22+
- fix: Rename variable and fix variables descriptions (#75) @bendavies @leoblanc
1023

1124
## [0.2.0] - 2020-06-15
1225

@@ -31,7 +44,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3144

3245
- First release.
3346

34-
[unreleased]: https://github.com/philips-labs/terraform-aws-github-runner/compare/v0.2.0..HEAD
47+
[unreleased]: https://github.com/philips-labs/terraform-aws-github-runner/compare/v0.3.0..HEAD
48+
[0.3.0]: https://github.com/philips-labs/terraform-aws-github-runner/releases/tag/v0.2.0..v0.3.0
3549
[0.2.0]: https://github.com/philips-labs/terraform-aws-github-runner/releases/tag/v0.1.0..v0.2.0
3650
[0.1.0]: https://github.com/philips-labs/terraform-aws-github-runner/releases/tag/v0.0.1..v0.1.0
3751
[0.0.1]: https://github.com/philips-labs/terraform-aws-github-runner/releases/tag/v0.0.1

README.md

Lines changed: 49 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ Permission are managed on several places. Below the most important ones. For det
5858

5959
Besides these permissions, the lambdas also need permission to CloudWatch (for logging and scheduling), SSM and S3. For more details about the required permissions see the [documentation](./modules/setup-iam-permissions/README.md) of the IAM module which uses permission boundaries.
6060

61+
### ARM64 support via Graviton/Graviton2 instance-types
62+
63+
When using the default example or top-level module, specifying an `instance_type` that matches a Graviton/Graviton 2 (ARM64) architecture (e.g. a1 or any 6th-gen `g` or `gd` type), the sub-modules will be automatically configured to provision with ARM64 AMIs and leverage GitHub's ARM64 action runner. See below for more details.
64+
6165
## Usages
6266

6367
Examples are provided in [the example directory](examples/). Please ensure you have installed the following tools.
@@ -94,9 +98,9 @@ Go to GitHub and create a new app. Beware you can create apps your organization
9498
First you need to download the lambda releases. The lambda code is available as a GitHub release asset. Downloading can be done with the provided terraform module for example. Note that this requires `curl` to be installed on your machine. Create an empty workspace with the following terraform code:
9599

96100
```terraform
97-
module "github-runner_download-lambda" {
101+
module "lambdas" {
98102
source = "philips-labs/github-runner/aws//modules/download-lambda"
99-
version = "0.1.0"
103+
version = "0.2.0"
100104
101105
lambdas = [
102106
{
@@ -151,6 +155,8 @@ module "github-runner" {
151155
}
152156
```
153157

158+
**ARM64** support: Specify an `a1` or `*6g*` (6th-gen Graviton2) instance type to stand up an ARM64 runner, otherwise the default is x86_64.
159+
154160
2. Run terraform by using the following commands
155161

156162
```bash
@@ -223,58 +229,59 @@ The following sub modules are optional and are provided as example or utility:
223229
- _[download-lambda](./modules/download-lambda/README.md)_ - Utility module to download lambda artifacts from GitHub Release
224230
- _[setup-iam-permissions](./modules/setup-iam-permissions/README.md)_ - Example module to setup permission boundaries
225231

226-
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
227-
## Requirements
232+
### ARM64 configuration for submodules
233+
234+
When not using the top-level module and specifying an `a1` or `*6g*` (6th-gen Graviton2) `instance_type`, the `runner-binaries-syncer` and `runners` submodules need to be configured appropriately for pulling the ARM64 GitHub action runner binary and leveraging the arm64 AMI for the runners.
228235

229-
No requirements.
236+
When configuring `runner-binaries-syncer`
230237

231-
## Providers
238+
- _runner_architecture_ - set to `arm64`, defaults to `x64`
232239

233-
| Name | Version |
234-
|------|---------|
235-
| aws | n/a |
236-
| random | n/a |
240+
When configuring `runners`
237241

242+
- _ami_filter_ - set to `["amzn2-ami-hvm-2*-arm64-gp2"]`, defaults to `["amzn2-ami-hvm-2.*-x86_64-ebs"]`
243+
244+
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
238245
## Inputs
239246

240247
| Name | Description | Type | Default | Required |
241-
|------|-------------|------|---------|:--------:|
242-
| aws\_region | AWS region. | `string` | n/a | yes |
243-
| enable\_organization\_runners | n/a | `bool` | n/a | yes |
244-
| encrypt\_secrets | Encrypt secret variables for lambda's such as secrets and private keys. | `bool` | `true` | no |
245-
| environment | A name that identifies the environment, used as prefix and for tagging. | `string` | n/a | yes |
246-
| github\_app | GitHub app parameters, see your github aapp. Ensure the key is base64 encoded. | <pre>object({<br> key_base64 = string<br> id = string<br> client_id = string<br> client_secret = string<br> webhook_secret = string<br> })</pre> | n/a | yes |
247-
| instance\_profile\_path | The path that will be added to the instance\_profile, if not set the environment name will be used. | `string` | `null` | no |
248-
| instance\_type | Instance type for the action runner. | `string` | `"m5.large"` | no |
249-
| kms\_key\_id | Custom KMS key to encrypted lambda secrets, if not provided and `encrypt_secrets` = `true` a KMS key will be created by the module. Secrets will be encrypted with a context `Environment = var.environment`. | `string` | `null` | no |
250-
| manage\_kms\_key | Let the module manage the KMS key. | `bool` | `true` | no |
251-
| minimum\_running\_time\_in\_minutes | The time an ec2 action runner should be running at minium before terminated if non busy. | `number` | `5` | no |
252-
| role\_path | The path that will be added to role path for created roles, if not set the environment name will be used. | `string` | `null` | no |
253-
| role\_permissions\_boundary | Permissions boundary that will be added to the created roles. | `string` | `null` | no |
254-
| runner\_as\_root | Run the action runner under the root user. | `bool` | `false` | no |
255-
| runner\_binaries\_syncer\_lambda\_timeout | Time out of the binaries sync lambda in seconds. | `number` | `300` | no |
256-
| runner\_binaries\_syncer\_lambda\_zip | File location of the binaries sync lambda zip file. | `string` | `null` | no |
257-
| runner\_extra\_labels | Extra labels for the runners (GitHub). Separate each label by a comma | `string` | `""` | no |
258-
| runners\_lambda\_zip | File location of the lambda zip file for scaling runners. | `string` | `null` | no |
259-
| runners\_maxiumum\_count | The maxiumum number of runners tha will be created. | `number` | `3` | no |
260-
| runners\_scale\_down\_lambda\_timeout | Time out for the scale up lambda in seconds. | `number` | `60` | no |
261-
| runners\_scale\_up\_lambda\_timeout | Time out for the scale down lambda in seconds. | `number` | `60` | no |
262-
| scale\_down\_schedule\_expression | Scheduler expression to check every x for scale down. | `string` | `"cron(*/5 * * * ? *)"` | no |
263-
| subnet\_ids | List of subnets in which the action runners will be launched, the subnets needs to be subnets in the `vpc_id`. | `list(string)` | n/a | yes |
264-
| tags | Map of tags that will be added to created resources. By default resources will be tagged with name and environment. | `map(string)` | `{}` | no |
265-
| userdata\_post\_install | Script to be ran after the GitHub Actions runner is installed on the EC2 instances | `string` | `""` | no |
266-
| userdata\_pre\_install | Script to be ran before the GitHub Actions runner is installed on the EC2 instances | `string` | `""` | no |
267-
| vpc\_id | The VPC for security groups of the action runners. | `string` | n/a | yes |
268-
| webhook\_lambda\_timeout | Time out of the webhook lambda in seconds. | `number` | `10` | no |
269-
| webhook\_lambda\_zip | File location of the wehbook lambda zip file. | `string` | `null` | no |
248+
|------|-------------|:----:|:-----:|:-----:|
249+
| aws\_region | AWS region. | string | n/a | yes |
250+
| enable\_organization\_runners | | bool | n/a | yes |
251+
| encrypt\_secrets | Encrypt secret variables for lambda's such as secrets and private keys. | bool | `"true"` | no |
252+
| environment | A name that identifies the environment, used as prefix and for tagging. | string | n/a | yes |
253+
| github\_app | GitHub app parameters, see your github app. Ensure the key is base64 encoded. | object | n/a | yes |
254+
| instance\_profile\_path | The path that will be added to the instance\_profile, if not set the environment name will be used. | string | `"null"` | no |
255+
| instance\_type | Instance type for the action runner. | string | `"m5.large"` | no |
256+
| kms\_key\_id | Custom KMS key to encrypted lambda secrets, if not provided and `encrypt\_secrets` = `true` a KMS key will be created by the module. Secrets will be encrypted with a context `Environment = var.environment`. | string | `"null"` | no |
257+
| manage\_kms\_key | Let the module manage the KMS key. | bool | `"true"` | no |
258+
| minimum\_running\_time\_in\_minutes | The time an ec2 action runner should be running at minimum before terminated if non busy. | number | `"5"` | no |
259+
| role\_path | The path that will be added to role path for created roles, if not set the environment name will be used. | string | `"null"` | no |
260+
| role\_permissions\_boundary | Permissions boundary that will be added to the created roles. | string | `"null"` | no |
261+
| runner\_as\_root | Run the action runner under the root user. | bool | `"false"` | no |
262+
| runner\_binaries\_syncer\_lambda\_timeout | Time out of the binaries sync lambda in seconds. | number | `"300"` | no |
263+
| runner\_binaries\_syncer\_lambda\_zip | File location of the binaries sync lambda zip file. | string | `"null"` | no |
264+
| runner\_extra\_labels | Extra labels for the runners \(GitHub\). Separate each label by a comma | string | `""` | no |
265+
| runners\_lambda\_zip | File location of the lambda zip file for scaling runners. | string | `"null"` | no |
266+
| runners\_maximum\_count | The maximum number of runners that will be created. | number | `"3"` | no |
267+
| runners\_scale\_down\_lambda\_timeout | Time out for the scale up lambda in seconds. | number | `"60"` | no |
268+
| runners\_scale\_up\_lambda\_timeout | Time out for the scale down lambda in seconds. | number | `"60"` | no |
269+
| scale\_down\_schedule\_expression | Scheduler expression to check every x for scale down. | string | `"cron(*/5 * * * ? *)"` | no |
270+
| subnet\_ids | List of subnets in which the action runners will be launched, the subnets needs to be subnets in the `vpc\_id`. | list(string) | n/a | yes |
271+
| tags | Map of tags that will be added to created resources. By default resources will be tagged with name and environment. | map(string) | `{}` | no |
272+
| userdata\_post\_install | Script to be ran after the GitHub Actions runner is installed on the EC2 instances | string | `""` | no |
273+
| userdata\_pre\_install | Script to be ran before the GitHub Actions runner is installed on the EC2 instances | string | `""` | no |
274+
| vpc\_id | The VPC for security groups of the action runners. | string | n/a | yes |
275+
| webhook\_lambda\_timeout | Time out of the webhook lambda in seconds. | number | `"10"` | no |
276+
| webhook\_lambda\_zip | File location of the webhook lambda zip file. | string | `"null"` | no |
270277

271278
## Outputs
272279

273280
| Name | Description |
274281
|------|-------------|
275-
| binaries\_syncer | n/a |
276-
| runners | n/a |
277-
| webhook | n/a |
282+
| binaries\_syncer | |
283+
| runners | |
284+
| webhook | |
278285

279286
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
280287

examples/.terraform-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.12.29

examples/default/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This modules shows how to create GitHub action runners. Lambda release will be d
44

55
## Usages
66

7-
Steps for the full setup, such as creating a GitHub app can be found in the root module's [README](../../README.md). First download the Lambda releases from GitHub. Alternatively you can build the lamdas locally with Node or Docker, there is a simple build script in `<root>/.ci/build.sh`. In the `main.tf` you can simple remove the location of the lambda zip files, the default location will work in this case.
7+
Steps for the full setup, such as creating a GitHub app can be found in the root module's [README](../../README.md). First download the Lambda releases from GitHub. Alternatively you can build the lambdas locally with Node or Docker, there is a simple build script in `<root>/.ci/build.sh`. In the `main.tf` you can simple remove the location of the lambda zip files, the default location will work in this case.
88

99
```bash
1010
cd lambdas-download

examples/default/main.tf

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ locals {
44
}
55

66
resource "random_password" "random" {
7-
length = 32
7+
length = 28
88
}
99

1010
module "runners" {
@@ -27,14 +27,14 @@ module "runners" {
2727
webhook_secret = random_password.random.result
2828
}
2929

30-
webhook_lambda_zip = "lambdas-download/webhook.zip"
31-
runner_binaries_syncer_lambda_zip = "lambdas-download/runner-binaries-syncer.zip"
32-
runners_lambda_zip = "lambdas-download/runners.zip"
33-
enable_organization_runners = false
34-
runner_extra_labels = "default,example"
35-
36-
# disable KMS and ecnryption
37-
# encrypt_secrets = false
38-
}
30+
# webhook_lambda_zip = "lambdas-download/webhook.zip"
31+
# runner_binaries_syncer_lambda_zip = "lambdas-download/runner-binaries-syncer.zip"
32+
# runners_lambda_zip = "lambdas-download/runners.zip"
33+
enable_organization_runners = false
34+
runner_extra_labels = "default,example"
3935

36+
# instance_type = "a1.large"
4037

38+
# disable KMS and encryption
39+
# encrypt_secrets = true
40+
}

0 commit comments

Comments
 (0)