This module shows how to create GitHub action runners with multiple runner configuration together in one deployment. This example has the configurations for the following runner types with the relevant labels supported by them as matchers:
- Linux ARM64
["self-hosted", "linux", "arm64", "amazon"]
- Linux Ubuntu
["self-hosted", "linux", "x64", "ubuntu-latest"]
or `["self-hosted", "linux", "x64", "ubuntu-2204"]`` - Linux X64
["self-hosted", "linux", "x64", "amazon"]
- Windows X64
["self-hosted", "windows", "x64", "servercore-2022"]
The module will decide the runner for the workflow job based on the match in the labels defined in the workflow job and runner configuration. Also the runner configuration allows the match to be exact or non-exact match. We recommend to use only exact matches.
For exact match, all the labels defined in the workflow should be present in the runner configuration matchers and for non-exact match, some of the labels in the workflow, when present in runner configuration, shall be enough for the runner configuration to be used for the job. First the exact matchers are applied, next the non exact ones.
For the list of provided runner configurations, there will be a single webhook and only a single Github App to receive the notifications for all types of workflow triggers.
Per combination of OS and architecture a lambda distribution syncer will be created. For this example there will be three instances (windows X64, linux X64, linux ARM).
Steps for the full setup, such as creating a GitHub app can be found in the root module's README. 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 simply remove the location of the lambda zip files, the default location will work in this case.
Ensure you have set the version in
lambdas-download/main.tf
for running the example. The version needs to be set to a GitHub release version, see https://github.com/philips-labs/terraform-aws-github-runner/releases
cd ../lambdas-download
terraform init
terraform apply -var=module_version=<VERSION>
cd -
Before running Terraform, ensure the GitHub app is configured. See the configuration details for more details.
terraform init
terraform apply
The module will try to update the GitHub App webhook and secret (only linux/mac). You can receive the webhook details by running:
terraform output webhook_secret
Name | Version |
---|---|
terraform | >= 1.3.0 |
aws | ~> 5.2 |
local | ~> 2.0 |
random | ~> 3.0 |
Name | Version |
---|---|
random | 3.5.1 |
Name | Source | Version |
---|---|---|
base | ../base | n/a |
multi-runner | ../../modules/multi-runner | n/a |
webhook-github-app | ../../modules/webhook-github-app | n/a |
Name | Type |
---|---|
random_id.random | resource |
Name | Description | Type | Default | Required |
---|---|---|---|---|
environment | n/a | string |
null |
no |
github_app | GitHub for API usages. | object({ |
n/a | yes |
Name | Description |
---|---|
webhook_endpoint | n/a |
webhook_secret | n/a |