Skip to content
This repository was archived by the owner on Jan 16, 2025. It is now read-only.

Commit 35219f5

Browse files
eabrouwer3npalm
andcommitted
feat!: replace Amazon Linux 2 by Amazon Linux 2023 as default Linux AMI (#3437)
Replaces Amazon lLnux 2 (default) by Amazon Linux 2023. Impact for anyone relying on the default setup provided by the module. --------- Co-authored-by: Niek Palm <[email protected]>
1 parent 8f9e999 commit 35219f5

File tree

15 files changed

+32
-31
lines changed

15 files changed

+32
-31
lines changed

Diff for: .github/workflows/packer-build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
image: index.docker.io/hashicorp/packer@sha256:297bbbbbbf3ce9e0431ac1e8f02934b20e1197613f877b55dfdb1ebfd94eb748 # ratchet:index.docker.io/hashicorp/packer:1.8.6
2020
strategy:
2121
matrix:
22-
image: ["linux-amzn2", "windows-core-2019", "windows-core-2022", "ubuntu-focal", "ubuntu-jammy", "ubuntu-jammy-arm64"]
22+
image: ["linux-al2023", "windows-core-2019", "windows-core-2022", "ubuntu-focal", "ubuntu-jammy", "ubuntu-jammy-arm64"]
2323
defaults:
2424
run:
2525
working-directory: images/${{ matrix.image }}

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ We welcome any improvement to the standard module to make the default as secure
528528
| <a name="input_instance_max_spot_price"></a> [instance\_max\_spot\_price](#input\_instance\_max\_spot\_price) | Max price price for spot instances per hour. This variable will be passed to the create fleet as max spot price for the fleet. | `string` | `null` | no |
529529
| <a name="input_instance_profile_path"></a> [instance\_profile\_path](#input\_instance\_profile\_path) | The path that will be added to the instance\_profile, if not set the environment name will be used. | `string` | `null` | no |
530530
| <a name="input_instance_target_capacity_type"></a> [instance\_target\_capacity\_type](#input\_instance\_target\_capacity\_type) | Default lifecycle used for runner instances, can be either `spot` or `on-demand`. | `string` | `"spot"` | no |
531-
| <a name="input_instance_types"></a> [instance\_types](#input\_instance\_types) | List of instance types for the action runner. Defaults are based on runner\_os (amzn2 for linux and Windows Server Core for win). | `list(string)` | <pre>[<br> "m5.large",<br> "c5.large"<br>]</pre> | no |
531+
| <a name="input_instance_types"></a> [instance\_types](#input\_instance\_types) | List of instance types for the action runner. Defaults are based on runner\_os (al2023 for linux and Windows Server Core for win). | `list(string)` | <pre>[<br> "m5.large",<br> "c5.large"<br>]</pre> | no |
532532
| <a name="input_job_queue_retention_in_seconds"></a> [job\_queue\_retention\_in\_seconds](#input\_job\_queue\_retention\_in\_seconds) | The number of seconds the job is held in the queue before it is purged. | `number` | `86400` | no |
533533
| <a name="input_key_name"></a> [key\_name](#input\_key\_name) | Key pair name | `string` | `null` | no |
534534
| <a name="input_kms_key_arn"></a> [kms\_key\_arn](#input\_kms\_key\_arn) | Optional CMK Key ARN to be used for Parameter Store. This key must be in the current account. | `string` | `null` | no |

Diff for: examples/ephemeral/main.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ module "runners" {
7171

7272
# configure your pre-built AMI
7373
# enable_userdata = false
74-
# ami_filter = { name = ["github-runner-amzn2-x86_64-*"], state = ["available"] }
74+
# ami_filter = { name = ["github-runner-al2023-x86_64-*"], state = ["available"] }
7575
# data "aws_caller_identity" "current" {}
7676
# ami_owners = [data.aws_caller_identity.current.account_id]
7777

Diff for: examples/prebuilt/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Steps for the full setup, such as creating a GitHub app can be found in the root
1313

1414
| Name | Description | Type | Default | Required |
1515
|------|-------------|------|---------|:--------:|
16-
| <a name="input_ami_filter"></a> [ami\_filter](#input\_ami\_filter) | The amis to search. Use the default for the provided amazon linux image, `github-runner-windows-core-2019-*` for the provided Windows image | `string` | `github-runner-amzn2-x86_64-2021*` | no |
16+
| <a name="input_ami_filter"></a> [ami\_filter](#input\_ami\_filter) | The amis to search. Use the default for the provided amazon linux image, `github-runner-windows-core-2019-*` for the provided Windows image | `string` | `github-runner-al2023-x86_64-2023*` | no |
1717
| <a name="input_github_app_key_base64"></a> [github\_app\_key\_base64](#input\_github\_app\_key\_base64) | The base64 encoded private key you downloaded from GitHub when creating the app | `string` | | yes |
1818
| <a name="input_github_app_id"></a> [github\_app\_id](#input\_github\_app\_id) | The id of the app you created on GitHub | `string` | | yes |
1919
| <a name="input_region"></a> [region](#input\_region) | The target aws region | `string` | `eu-west-1` | no |
@@ -52,13 +52,13 @@ You will need to build your image. This example deployment uses the image exampl
5252

5353
To use your image in the terraform modules you will need to set some values on the module.
5454

55-
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.
55+
Assuming you have built the `linux-al2023` image which has a pre-defined AMI name in the following format `github-runner-al2023-x86_64-YYYYMMDDhhmm` you can use the following values.
5656

5757
```hcl
5858
module "runners" {
5959
...
6060
# set the name of the ami to use
61-
ami_filter = { name = ["github-runner-amzn2-x86_64-2021*"], state = ["available"] }
61+
ami_filter = { name = ["github-runner-al2023-x86_64-2023*"], state = ["available"] }
6262
# provide the owner id of
6363
ami_owners = ["<your owner id>"]
6464
@@ -128,7 +128,7 @@ terraform output webhook_secret
128128

129129
| Name | Description | Type | Default | Required |
130130
|------|-------------|------|---------|:--------:|
131-
| <a name="input_ami_name_filter"></a> [ami\_name\_filter](#input\_ami\_name\_filter) | n/a | `string` | `"github-runner-amzn2-x86_64-*"` | no |
131+
| <a name="input_ami_name_filter"></a> [ami\_name\_filter](#input\_ami\_name\_filter) | n/a | `string` | `"github-runner-al2023-x86_64-*"` | no |
132132
| <a name="input_github_app"></a> [github\_app](#input\_github\_app) | GitHub for API usages. | <pre>object({<br> id = string<br> key_base64 = string<br> })</pre> | n/a | yes |
133133
| <a name="input_runner_os"></a> [runner\_os](#input\_runner\_os) | n/a | `string` | `"linux"` | no |
134134

Diff for: examples/prebuilt/variables.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ variable "runner_os" {
1414

1515
variable "ami_name_filter" {
1616
type = string
17-
default = "github-runner-amzn2-x86_64-*"
17+
default = "github-runner-al2023-x86_64-*"
1818
}

Diff for: images/README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ The images inside this folder are pre-built images designed to shorten the boot
44

55
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.
66

7-
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.
7+
The examples in `linux-al2023` 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.
88

99
## Building your own
1010

1111
To build these images you first need to install packer.
1212
You will also need an amazon account and to have provisioned your credentials for packer to consume.
1313

14-
Assuming you are building the `linux-amzn2` image. Then run the following from within the `linux-amzn2` folder
14+
Assuming you are building the `linux-al2023` image. Then run the following from within the `linux-al2023` folder
1515

1616
```bash
1717
packer init .
@@ -25,12 +25,12 @@ Your image will then begin to build inside AWS and when finished you will be pro
2525

2626
To use your image in the terraform modules you will need to set some values on the module.
2727

28-
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.
28+
Assuming you have built the `linux-al2023` image which has a pre-defined AMI name in the following format `github-runner-al2023-x86_64-YYYYMMDDhhmm` you can use the following values.
2929

3030
```hcl
3131
# set the name of the ami to use
32-
ami_filter = { name = ["github-runner-amzn2-x86_64-2021*"] }
33-
# provide the owner id of
32+
ami_filter = { name = ["github-runner-al2023-x86_64-2023*"] }
33+
# provide the owner id of
3434
ami_owners = ["<your owner id>"]
3535
3636
enable_userdata = false

Diff for: images/linux-amzn2/github_agent.linux.pkr.hcl renamed to images/linux-al2023/github_agent.linux.pkr.hcl

+6-6
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ locals {
9696
}
9797

9898
source "amazon-ebs" "githubrunner" {
99-
ami_name = "github-runner-amzn2-x86_64-${formatdate("YYYYMMDDhhmm", timestamp())}"
99+
ami_name = "github-runner-al2023-x86_64-${formatdate("YYYYMMDDhhmm", timestamp())}"
100100
instance_type = var.instance_type
101101
region = var.region
102102
security_group_id = var.security_group_id
@@ -106,7 +106,7 @@ source "amazon-ebs" "githubrunner" {
106106

107107
source_ami_filter {
108108
filters = {
109-
name = "amzn2-ami-kernel-5.*-hvm-*-x86_64-gp2"
109+
name = "al2023-ami-2023.*-kernel-6.*-x86_64"
110110
root-device-type = "ebs"
111111
virtualization-type = "hvm"
112112
}
@@ -118,7 +118,7 @@ source "amazon-ebs" "githubrunner" {
118118
var.global_tags,
119119
var.ami_tags,
120120
{
121-
OS_Version = "amzn2"
121+
OS_Version = "al2023"
122122
Release = "Latest"
123123
Base_AMI_Name = "{{ .SourceAMIName }}"
124124
})
@@ -144,9 +144,9 @@ build {
144144
provisioner "shell" {
145145
environment_vars = []
146146
inline = concat([
147-
"sudo yum update -y",
148-
"sudo yum install -y amazon-cloudwatch-agent curl jq git",
149-
"sudo amazon-linux-extras install docker",
147+
"sudo dnf upgrade-minimal -y",
148+
"sudo dnf install -y amazon-cloudwatch-agent jq git docker",
149+
"sudo dnf install -y --allowerasing curl",
150150
"sudo systemctl enable docker.service",
151151
"sudo systemctl enable containerd.service",
152152
"sudo service docker start",

0 commit comments

Comments
 (0)