The images inside this folder are pre-built images designed to shorten the boot time of your runners and make using ephemeral runners a faster experience.
These images share the same scripting as used in the user-data mechanism in /modules/runners/templates/
. We use a templatefile
mechanism to insert the relevant script fragments into the scripts used for provisioning the images.
The examples in linux-amzn2
and windows-core-2019
also upload a start-runner
script that uses the exact same startup process as used in the user-data mechanism. This means that the image created here does not need any extra scripts injected or changes to boot up and connect to GH.
To build these images you first need to install packer. You will also need an amazon account and to have provisioned your credentials for packer to consume.
Assuming you are building the linux-amzn2
image. Then run the following from within the linux-amzn2
folder
packer init .
packer validate .
packer build github_agent.linux.pkr.hcl
Your image will then begin to build inside AWS and when finished you will be provided with complete AMI.
To use your image in the terraform modules you will need to set some values on the module.
Assuming you have built the linux-amzn2
image which has a pre-defined AMI name in the following format github-runner-amzn2-x86_64-YYYYMMDDhhmm
you can use the following values.
# set the name of the ami to use
ami_filter = { name = ["github-runner-amzn2-x86_64-2021*"] }
# provide the owner id of
ami_owners = ["<your owner id>"]
enable_userdata = false