Skip to content

Commit 8a169f9

Browse files
authored
Merge branch 'main' into fix/ubuntu-24.04
2 parents 4cfe147 + 0cde7a5 commit 8a169f9

File tree

24 files changed

+1165
-678
lines changed

24 files changed

+1165
-678
lines changed

.ci/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#syntax=docker/dockerfile:1.2
2-
FROM node:20 as build
2+
FROM node@sha256:0c0734eb7051babbb3e95cd74e684f940552b31472152edf0bb23e54ab44a0d7 as build
33
WORKDIR /lambdas
44
RUN apt-get update \
55
&& apt-get install -y zip \

.devcontainer/Dockerfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
ARG VARIANT="20-bullseye"
2-
FROM mcr.microsoft.com/vscode/devcontainers/typescript-node:0-${VARIANT}
1+
FROM mcr.microsoft.com/vscode/devcontainers/typescript-node@sha256:acdce1045a2ddce4c66846d5cd09adf746d157fce9233124e4925b647f192b2e

.github/dependabot.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,23 @@ updates:
5151
commit-message:
5252
prefix: "fix(lambda)"
5353
prefix-development: "chore(lambda)"
54+
55+
- package-ecosystem: "docker"
56+
directory: "/.ci/Dockerfile"
57+
schedule:
58+
interval: "weekly"
59+
labels:
60+
- "dependencies"
61+
- "docker"
62+
commit-message:
63+
prefix: "chore(docker)"
64+
65+
- package-ecosystem: "docker"
66+
directory: "/.devcontainer/Dockerfile"
67+
schedule:
68+
interval: "weekly"
69+
labels:
70+
- "dependencies"
71+
- "docker"
72+
commit-message:
73+
prefix: "chore(devcontainer)"
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: OSSF Scorecard supply-chain security
2+
on:
3+
branch_protection_rule:
4+
schedule:
5+
- cron: '44 19 * * 2'
6+
workflow_dispatch:
7+
push:
8+
branches: [ "main" ]
9+
10+
permissions: read-all
11+
12+
jobs:
13+
analysis:
14+
name: Scorecard analysis
15+
runs-on: ubuntu-latest
16+
if: github.event.repository.default_branch == github.ref_name || github.event_name == 'pull_request'
17+
permissions:
18+
security-events: write
19+
id-token: write
20+
21+
steps:
22+
- name: "Checkout code"
23+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
24+
with:
25+
persist-credentials: false
26+
27+
- name: "Run analysis"
28+
uses: ossf/scorecard-action@05b42c624433fc40578a4040d5cf5e36ddca8cde # v2.4.2
29+
with:
30+
results_file: results.sarif
31+
results_format: sarif
32+
publish_results: true
33+
34+
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
35+
# format to the repository Actions tab.
36+
- name: "Upload artifact"
37+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
38+
with:
39+
name: SARIF file
40+
path: results.sarif
41+
retention-days: 5
42+
43+
# Upload the results to GitHub's code scanning dashboard (optional).
44+
# Commenting out will disable upload of results to your repo's Code Scanning dashboard
45+
- name: "Upload to code-scanning"
46+
uses: github/codeql-action/upload-sarif@ce28f5bb42b7a9f2c824e633a3f6ee835bab6858
47+
with:
48+
sarif_file: results.sarif

.github/workflows/release.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,23 @@ jobs:
7474
for f in $(find . -name '*.zip'); do
7575
gh release upload $tag_name $f
7676
done
77+
- name: Attach attestation
78+
if: ${{ steps.release.outputs.releases_created == 'true' }}
79+
env:
80+
ATTESTATION_BUNDLE: ${{ steps.attest.outputs.bundle-path }}
81+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
82+
TAG_NAME: ${{ steps.release.outputs.tag_name }}
83+
ATTESTATION_ID: ${{ steps.attest.outputs.attestation-id }}
84+
run: |
85+
# rename attest bundle to github-aws-runners-terraform-aws-github-runner-attestation-$attestation-id.sigstore
86+
# OpenSSF expects the attestation bundle to be named in this format (*.sigstore)
87+
SIGSTORE_BUNDLE=$RUNNER_TEMP/github-aws-runners-terraform-aws-github-runner-attestation-${ATTESTATION_ID}.sigstore
88+
INTOTO_BUNDLE=$RUNNER_TEMP/github-aws-runners-terraform-aws-github-runner-attestation-${ATTESTATION_ID}.intoto.jsonl
89+
mv ${ATTESTATION_BUNDLE} $SIGSTORE_BUNDLE
90+
if [ -z "$SIGSTORE_BUNDLE" ]; then
91+
echo "No attestation bundle found, skipping attachment."
92+
exit 0
93+
fi
94+
gh release upload $TAG_NAME "$SIGSTORE_BUNDLE"
95+
cat ${SIGSTORE_BUNDLE} | jq -r '.dsseEnvelope | select(.payloadType == "application/vnd.in-toto+json").payload' | base64 -d | jq .> ${INTOTO_BUNDLE}
96+
gh release upload $TAG_NAME "${INTOTO_BUNDLE}"

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
# Changelog
22

3+
## [6.5.11](https://github.com/github-aws-runners/terraform-aws-github-runner/compare/v6.5.10...v6.5.11) (2025-06-24)
4+
5+
6+
### Bug Fixes
7+
8+
* **lambda:** bump the aws group in /lambdas with 3 updates ([#4632](https://github.com/github-aws-runners/terraform-aws-github-runner/issues/4632)) ([59d67f5](https://github.com/github-aws-runners/terraform-aws-github-runner/commit/59d67f52d88eac2fd79161dcf02cb3145cddb2cc))
9+
* **lambda:** bump the aws-powertools group in /lambdas with 4 updates ([#4633](https://github.com/github-aws-runners/terraform-aws-github-runner/issues/4633)) ([bf91646](https://github.com/github-aws-runners/terraform-aws-github-runner/commit/bf9164643d8a82c381c7043fd17110ab17e5959e))
10+
11+
## [6.5.10](https://github.com/github-aws-runners/terraform-aws-github-runner/compare/v6.5.9...v6.5.10) (2025-06-23)
12+
13+
14+
### Bug Fixes
15+
16+
* **ami-housekeeper:** don't delete referenced AMIs in default config ([#4623](https://github.com/github-aws-runners/terraform-aws-github-runner/issues/4623)) ([d860feb](https://github.com/github-aws-runners/terraform-aws-github-runner/commit/d860febe38b52cfd410c5f0e4d668791346cebda))
17+
* **docs:** github artifact attestation command in release notes ([#4624](https://github.com/github-aws-runners/terraform-aws-github-runner/issues/4624)) ([ff39d4f](https://github.com/github-aws-runners/terraform-aws-github-runner/commit/ff39d4f30992f7e37db086ae01c49c9ce233334f))
18+
319
## [6.5.9](https://github.com/github-aws-runners/terraform-aws-github-runner/compare/v6.5.8...v6.5.9) (2025-06-17)
420

521

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Terraform module Self-Hosted Scalable GitHub Actions runners on AWS.
22

3-
[![docs](https://img.shields.io/badge/docs-runners-blue.svg)](https://github-aws-runners.github.io/terraform-aws-github-runner) [![awesome-runners](https://img.shields.io/badge/listed%20on-awesome--runners-blue.svg)](https://github.com/jonico/awesome-runners) [![Terraform registry](https://img.shields.io/github/v/release/github-aws-runners/terraform-aws-github-runner?label=Terraform%20Registry)](https://registry.terraform.io/modules/github-aws-runners/github-runner/aws/) [![Terraform checks](https://github.com/github-aws-runners/terraform-aws-github-runner/actions/workflows/terraform.yml/badge.svg)](https://github.com/github-aws-runners/terraform-aws-github-runner/actions/workflows/terraform.yml) [![Lambdas](https://github.com/github-aws-runners/terraform-aws-github-runner/actions/workflows/lambda.yml/badge.svg)](https://github.com/github-aws-runners/terraform-aws-github-runner/actions/workflows/lambda.yml)
3+
[![docs](https://img.shields.io/badge/docs-runners-blue.svg)](https://github-aws-runners.github.io/terraform-aws-github-runner) [![awesome-runners](https://img.shields.io/badge/listed%20on-awesome--runners-blue.svg)](https://github.com/jonico/awesome-runners) [![Terraform registry](https://img.shields.io/github/v/release/github-aws-runners/terraform-aws-github-runner?label=Terraform%20Registry)](https://registry.terraform.io/modules/github-aws-runners/github-runner/aws/) [![Terraform checks](https://github.com/github-aws-runners/terraform-aws-github-runner/actions/workflows/terraform.yml/badge.svg)](https://github.com/github-aws-runners/terraform-aws-github-runner/actions/workflows/terraform.yml) [![Lambdas](https://github.com/github-aws-runners/terraform-aws-github-runner/actions/workflows/lambda.yml/badge.svg)](https://github.com/github-aws-runners/terraform-aws-github-runner/actions/workflows/lambda.yml) [![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/github-aws-runners/terraform-aws-github-runner/badge)](https://scorecard.dev/viewer/?uri=github.com/github-aws-runners/terraform-aws-github-runner)
44

55
> 📢 We're moving `terraform-aws-github-runner` to a new organization https://github.com/github-aws-runners in January to foster growth and community ownership! 🎉 Join us on our new [Discord server](https://discord.gg/bxgXW8jJGh) for discussions and updates. Please see #4298 for more details.
66

examples/prebuilt/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,18 @@ This module shows how to create GitHub action runners using a prebuilt AMI for t
77

88
@@ Usages
99

10+
11+
Steps for the full setup, such as creating a GitHub app can be found in the root module's [README](https://github.com/github-aws-runners/terraform-aws-github-runner). First download the Lambda releases from GitHub. Alternatively you can build the lambdas locally with Node or Docker, there is a simple build script in `<root>/.ci/build.sh`. In the `main.tf` you can simply remove the location of the lambda zip files, the default location will work in this case.
12+
13+
> This example assumes local built lambda's available. Ensure you have built the lambda's. Alternatively you can download the lambda's. The version needs to be set to a GitHub release version, see https://github.com/github-aws-runners/terraform-aws-github-runner/releases
14+
15+
```bash
16+
cd ../lambdas-download
17+
terraform init
18+
terraform apply -var=module_version=<VERSION>
19+
cd -
20+
```
21+
1022
### Packer Image
1123

1224
You will need to build your image. This example deployment uses the image example in `/images/linux-amz2`. You must build this image with packer in your AWS account first. Once you have built this you need to provider your owner ID as a variable
@@ -92,6 +104,8 @@ terraform output webhook_secret
92104
| Name | Description | Type | Default | Required |
93105
|------|-------------|------|---------|:--------:|
94106
| <a name="input_ami_name_filter"></a> [ami\_name\_filter](#input\_ami\_name\_filter) | AMI name filter for the action runner AMI. By default amazon linux 2 is used. | `string` | `"github-runner-al2023-x86_64-*"` | no |
107+
| <a name="input_aws_region"></a> [aws\_region](#input\_aws\_region) | AWS region. | `string` | `"eu-west-1"` | no |
108+
| <a name="input_environment"></a> [environment](#input\_environment) | Environment name, used as prefix. | `string` | `null` | no |
95109
| <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 |
96110
| <a name="input_runner_os"></a> [runner\_os](#input\_runner\_os) | The EC2 Operating System type to use for action runner instances (linux,windows). | `string` | `"linux"` | no |
97111

examples/prebuilt/main.tf

Lines changed: 46 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
locals {
2-
environment = "prebuilt"
3-
aws_region = "eu-west-1"
2+
environment = var.environment != null ? var.environment : "default"
3+
aws_region = var.aws_region
44
}
55

66
resource "random_id" "random" {
@@ -32,9 +32,12 @@ module "runners" {
3232
webhook_secret = random_id.random.hex
3333
}
3434

35-
webhook_lambda_zip = "../lambdas-download/webhook.zip"
36-
runner_binaries_syncer_lambda_zip = "../lambdas-download/runner-binaries-syncer.zip"
37-
runners_lambda_zip = "../lambdas-download/runners.zip"
35+
# link to downloaded lambda zip files.
36+
# When not explicitly set lambda zip files are grabbed from the module requiring lambda build.
37+
#
38+
# webhook_lambda_zip = "../lambdas-download/webhook.zip"
39+
# runner_binaries_syncer_lambda_zip = "../lambdas-download/runner-binaries-syncer.zip"
40+
# runners_lambda_zip = "../lambdas-download/runners.zip"
3841

3942
runner_extra_labels = ["default", "example"]
4043

@@ -56,6 +59,44 @@ module "runners" {
5659

5760
# override scaling down
5861
scale_down_schedule_expression = "cron(* * * * ? *)"
62+
63+
enable_ami_housekeeper = true
64+
ami_housekeeper_cleanup_config = {
65+
ssmParameterNames = ["*/ami_id"]
66+
minimumDaysOld = 1
67+
dryRun = true
68+
amiFilters = [
69+
{
70+
Name = "name"
71+
Values = ["*al2023*"]
72+
}
73+
]
74+
}
75+
76+
# variable "runners_ssm_housekeeper" {
77+
# description = <<EOF
78+
# Configuration for the SSM housekeeper lambda. This lambda deletes token / JIT config from SSM.
79+
80+
# `schedule_expression`: is used to configure the schedule for the lambda.
81+
# `enabled`: enable or disable the lambda trigger via the EventBridge.
82+
# `lambda_memory_size`: lambda memery size limit.
83+
# `lambda_timeout`: timeout for the lambda in seconds.
84+
# `config`: configuration for the lambda function. Token path will be read by default from the module.
85+
# EOF
86+
# type = object({
87+
# schedule_expression = optional(string, "rate(1 day)")
88+
# enabled = optional(bool, true)
89+
# lambda_memory_size = optional(number, 512)
90+
# lambda_timeout = optional(number, 60)
91+
# config = object({
92+
# tokenPath = optional(string)
93+
# minimumDaysOld = optional(number, 1)
94+
# dryRun = optional(bool, false)
95+
# })
96+
# })
97+
# default = { config = {} }
98+
99+
# log_level = "debug"
59100
}
60101

61102
module "webhook_github_app" {

examples/prebuilt/variables.tf

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,20 @@ variable "github_app" {
77
})
88
}
99

10+
variable "environment" {
11+
description = "Environment name, used as prefix."
12+
13+
type = string
14+
default = null
15+
}
16+
17+
variable "aws_region" {
18+
description = "AWS region."
19+
20+
type = string
21+
default = "eu-west-1"
22+
}
23+
1024
variable "runner_os" {
1125
description = "The EC2 Operating System type to use for action runner instances (linux,windows)."
1226

0 commit comments

Comments
 (0)