Goals of this blog post:
- Create a GitHub workflow to build an ARM64 Ubuntu-based GitHub runner image using Packer
- Use the AWS GitHub self-hosted X86_64/AMD64 runner infrastructure to run the workflow
Prerequisite Knowledge
- Build of ARM Images on x86_64/AMD64 Hosts using Packer
- Scalable Self-hosted GitHub Runners on AWS Cloud
- Authenticate from GitHub Workflows to AWS Services using OpenID Connect (OIDC)
Create Repository
- Create a GitHub repository using the following as a template:
Webhook
- Ensure a GitHub webhook is configured to deliver workflow queued events to an AWS EventBridge Bus
- a corresponding rule for the Event Bus should exist
- the rule’s event pattern pattern should be configured to check for runner label prefix: debian-amd64
- when an event matches the rule criteria, an ephemeral AMD64 self-hosted runner should run the workflow to build an ARM64 runner image
- the workflow should also push the final image to ECR
Repository Variables/Secrets
Variables
ECR_REPO | ECR repository where ARM image will be uploaded to |
RUNNER_PREFIX | Self-Hosted runner label prefix |
Secrets
AWS_ACCOUNT_ID | Target AWS account 12 digit Identifier |
AWS_REGION | AWS Region |
OIDC_ROLE | The name of the OIDC IAM role which permits the workflow to perform scoped actions on target resources |
Sample Build Output
Output from a sample workflow is shown below:
Build of the ARM-based image on AMD64 self-hosted runner progress:
Finally, the image is tagged and pushed to ECR: