-
Notifications
You must be signed in to change notification settings - Fork 722
feat: Introduce Amazon Linux 2023 ARM image #4780
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 6 commits
3d30fc0
aeaca0c
dac5853
6e595ef
defeda2
ebbff38
187deb1
63558e8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| packer { | ||
| required_plugins { | ||
| amazon = { | ||
| version = ">= 0.0.2" | ||
| version = ">= 1.0.0" | ||
| source = "github.com/hashicorp/amazon" | ||
| } | ||
| } | ||
|
|
@@ -12,6 +12,16 @@ variable "runner_version" { | |
| default = null | ||
| } | ||
|
|
||
| variable "architecture" { | ||
| description = "The architecture of the runner. Supported values are 'x64' and 'arm64'" | ||
| type = string | ||
| default = "x64" | ||
| validation { | ||
| condition = contains(["arm64", "x64"], var.architecture) | ||
| error_message = "`architecture` value is not valid, valid values are: `arm64` and `x64`." | ||
| } | ||
| } | ||
|
|
||
| variable "region" { | ||
| description = "The region to build the image in" | ||
| type = string | ||
|
|
@@ -39,7 +49,7 @@ variable "associate_public_ip_address" { | |
| variable "instance_type" { | ||
| description = "The instance type Packer will use for the builder" | ||
| type = string | ||
| default = "m3.medium" | ||
| default = null | ||
| } | ||
|
|
||
| variable "iam_instance_profile" { | ||
|
|
@@ -99,12 +109,13 @@ data "http" github_runner_release_json { | |
|
|
||
| locals { | ||
| runner_version = coalesce(var.runner_version, trimprefix(jsondecode(data.http.github_runner_release_json.body).tag_name, "v")) | ||
| instance_type = coalesce(var.instance_type, var.architecture == "arm64" ? "t4g.medium" : "m3.medium") | ||
| } | ||
|
|
||
| source "amazon-ebs" "githubrunner" { | ||
| ami_name = "github-runner-al2023-x86_64-${formatdate("YYYYMMDDhhmm", timestamp())}" | ||
| instance_type = var.instance_type | ||
| iam_instance_profile = var.iam_instance_profile | ||
| ami_name = "github-runner-al2023-${var.architecture}-${formatdate("YYYYMMDDhhmm", timestamp())}" | ||
| instance_type = local.instance_type | ||
| iam_instance_profile = var.iam_instance_profile | ||
| region = var.region | ||
| security_group_id = var.security_group_id | ||
| subnet_id = var.subnet_id | ||
|
|
@@ -113,7 +124,7 @@ source "amazon-ebs" "githubrunner" { | |
|
|
||
| source_ami_filter { | ||
| filters = { | ||
| name = "al2023-ami-2023.*-kernel-6.*-x86_64" | ||
| name = "al2023-ami-2023.*-kernel-6.*-${var.architecture == "x64" ? "x86_64" : var.architecture}" | ||
|
||
| root-device-type = "ebs" | ||
| virtualization-type = "hvm" | ||
| } | ||
|
|
@@ -166,20 +177,19 @@ build { | |
| install_runner = templatefile("../../modules/runners/templates/install-runner.sh", { | ||
| ARM_PATCH = "" | ||
| S3_LOCATION_RUNNER_DISTRIBUTION = "" | ||
| RUNNER_ARCHITECTURE = "x64" | ||
| }) | ||
| }) | ||
| destination = "/tmp/install-runner.sh" | ||
| } | ||
|
|
||
| provisioner "shell" { | ||
| environment_vars = [ | ||
| "RUNNER_TARBALL_URL=https://github.com/actions/runner/releases/download/v${local.runner_version}/actions-runner-linux-x64-${local.runner_version}.tar.gz" | ||
| "RUNNER_TARBALL_URL=https://github.com/actions/runner/releases/download/v${local.runner_version}/actions-runner-linux-${var.architecture}-${local.runner_version}.tar.gz" | ||
| ] | ||
| inline = [ | ||
| "sudo chmod +x /tmp/install-runner.sh", | ||
| "echo ec2-user > /tmp/install-user.txt", | ||
| "sudo RUNNER_ARCHITECTURE=x64 RUNNER_TARBALL_URL=$RUNNER_TARBALL_URL /tmp/install-runner.sh" | ||
| "sudo RUNNER_TARBALL_URL=$RUNNER_TARBALL_URL /tmp/install-runner.sh" | ||
| ] | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,7 +3,6 @@ | |
| ## install the runner | ||
|
|
||
| s3_location=${S3_LOCATION_RUNNER_DISTRIBUTION} | ||
| architecture=${RUNNER_ARCHITECTURE} | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is the reason of removing this variable? Is it not used?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems like it's not used, it was introduced in #1624 which added a condition: But that was eventually removed by #3437 because |
||
|
|
||
| if [ -z "$RUNNER_TARBALL_URL" ] && [ -z "$s3_location" ]; then | ||
| echo "Neither RUNNER_TARBALL_URL or s3_location are set" | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.