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 tempaltefile
mechanism to insert the relevant script fragments into the scripts used for provisioning the images.
The example in linux-amzn2
also uploads a start-runner.sh
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>"]
enabled_userdata = false