Skip to content

Commit 231fd15

Browse files
authored
Merge pull request #2232 from philips-labs/develop
chore: release
2 parents 27f5b48 + 486ae91 commit 231fd15

File tree

8 files changed

+349
-164
lines changed

8 files changed

+349
-164
lines changed

images/ubuntu-focal/github_agent.ubuntu.pkr.hcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ source "amazon-ebs" "githubrunner" {
8888

8989
source_ami_filter {
9090
filters = {
91-
name = "*/ubuntu-focal-20.04-amd64-server-*"
91+
name = "*ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-*"
9292
root-device-type = "ebs"
9393
virtualization-type = "hvm"
9494
}
Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
packer {
2+
required_plugins {
3+
amazon = {
4+
version = ">= 0.0.2"
5+
source = "github.com/hashicorp/amazon"
6+
}
7+
}
8+
}
9+
10+
variable "runner_version" {
11+
description = "The version (no v prefix) of the runner software to install https://github.com/actions/runner/releases"
12+
type = string
13+
default = "2.294.0"
14+
}
15+
16+
variable "region" {
17+
description = "The region to build the image in"
18+
type = string
19+
default = "eu-west-1"
20+
}
21+
22+
variable "security_group_id" {
23+
description = "The ID of the security group Packer will associate with the builder to enable access"
24+
type = string
25+
default = null
26+
}
27+
28+
variable "subnet_id" {
29+
description = "If using VPC, the ID of the subnet, such as subnet-12345def, where Packer will launch the EC2 instance. This field is required if you are using an non-default VPC"
30+
type = string
31+
default = null
32+
}
33+
34+
variable "associate_public_ip_address" {
35+
description = "If using a non-default VPC, there is no public IP address assigned to the EC2 instance. If you specified a public subnet, you probably want to set this to true. Otherwise the EC2 instance won't have access to the internet"
36+
type = string
37+
default = null
38+
}
39+
40+
variable "instance_type" {
41+
description = "The instance type Packer will use for the builder"
42+
type = string
43+
default = "t3.medium"
44+
}
45+
46+
variable "root_volume_size_gb" {
47+
type = number
48+
default = 8
49+
}
50+
51+
variable "ebs_delete_on_termination" {
52+
description = "Indicates whether the EBS volume is deleted on instance termination."
53+
type = bool
54+
default = true
55+
}
56+
57+
variable "global_tags" {
58+
description = "Tags to apply to everything"
59+
type = map(string)
60+
default = {}
61+
}
62+
63+
variable "ami_tags" {
64+
description = "Tags to apply to the AMI"
65+
type = map(string)
66+
default = {}
67+
}
68+
69+
variable "snapshot_tags" {
70+
description = "Tags to apply to the snapshot"
71+
type = map(string)
72+
default = {}
73+
}
74+
75+
variable "custom_shell_commands" {
76+
description = "Additional commands to run on the EC2 instance, to customize the instance, like installing packages"
77+
type = list(string)
78+
default = []
79+
}
80+
81+
source "amazon-ebs" "githubrunner" {
82+
ami_name = "github-runner-ubuntu-jammy-amd64-${formatdate("YYYYMMDDhhmm", timestamp())}"
83+
instance_type = var.instance_type
84+
region = var.region
85+
security_group_id = var.security_group_id
86+
subnet_id = var.subnet_id
87+
associate_public_ip_address = var.associate_public_ip_address
88+
89+
source_ami_filter {
90+
filters = {
91+
name = "*/ubuntu-jammy-22.04-amd64-server-*"
92+
root-device-type = "ebs"
93+
virtualization-type = "hvm"
94+
}
95+
most_recent = true
96+
owners = ["099720109477"]
97+
}
98+
ssh_username = "ubuntu"
99+
tags = merge(
100+
var.global_tags,
101+
var.ami_tags,
102+
{
103+
OS_Version = "ubuntu-jammy"
104+
Release = "Latest"
105+
Base_AMI_Name = "{{ .SourceAMIName }}"
106+
})
107+
snapshot_tags = merge(
108+
var.global_tags,
109+
var.snapshot_tags,
110+
)
111+
112+
launch_block_device_mappings {
113+
device_name = "/dev/sda1"
114+
volume_size = "${var.root_volume_size_gb}"
115+
volume_type = "gp3"
116+
delete_on_termination = "${var.ebs_delete_on_termination}"
117+
}
118+
}
119+
120+
build {
121+
name = "githubactions-runner"
122+
sources = [
123+
"source.amazon-ebs.githubrunner"
124+
]
125+
provisioner "shell" {
126+
environment_vars = [
127+
"DEBIAN_FRONTEND=noninteractive"
128+
]
129+
inline = concat([
130+
"sudo apt-get -y update",
131+
"sudo apt-get -y install ca-certificates curl gnupg lsb-release",
132+
"sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg",
133+
"echo deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null",
134+
"sudo apt-get -y update",
135+
"sudo apt-get -y install docker-ce docker-ce-cli containerd.io jq git unzip",
136+
"sudo systemctl enable containerd.service",
137+
"sudo service docker start",
138+
"sudo usermod -a -G docker ubuntu",
139+
"sudo curl -f https://s3.amazonaws.com/amazoncloudwatch-agent/ubuntu/amd64/latest/amazon-cloudwatch-agent.deb -o amazon-cloudwatch-agent.deb",
140+
"sudo dpkg -i amazon-cloudwatch-agent.deb",
141+
"sudo systemctl restart amazon-cloudwatch-agent",
142+
"sudo curl -f https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip -o awscliv2.zip",
143+
"unzip awscliv2.zip",
144+
"sudo ./aws/install",
145+
], var.custom_shell_commands)
146+
}
147+
148+
provisioner "file" {
149+
content = templatefile("../install-runner.sh", {
150+
install_runner = templatefile("../../modules/runners/templates/install-runner.sh", {
151+
ARM_PATCH = ""
152+
S3_LOCATION_RUNNER_DISTRIBUTION = ""
153+
RUNNER_ARCHITECTURE = "x64"
154+
})
155+
})
156+
destination = "/tmp/install-runner.sh"
157+
}
158+
159+
provisioner "shell" {
160+
environment_vars = [
161+
"RUNNER_TARBALL_URL=https://github.com/actions/runner/releases/download/v${var.runner_version}/actions-runner-linux-x64-${var.runner_version}.tar.gz"
162+
]
163+
inline = [
164+
"sudo chmod +x /tmp/install-runner.sh",
165+
"echo ubuntu | tee -a /tmp/install-user.txt",
166+
"sudo RUNNER_ARCHITECTURE=x64 RUNNER_TARBALL_URL=$RUNNER_TARBALL_URL /tmp/install-runner.sh",
167+
"echo ImageOS=ubuntu22 | tee -a /opt/actions-runner/.env"
168+
]
169+
}
170+
171+
provisioner "file" {
172+
content = templatefile("../start-runner.sh", {
173+
start_runner = templatefile("../../modules/runners/templates/start-runner.sh", {})
174+
})
175+
destination = "/tmp/start-runner.sh"
176+
}
177+
178+
provisioner "shell" {
179+
inline = [
180+
"sudo mv /tmp/start-runner.sh /var/lib/cloud/scripts/per-boot/start-runner.sh",
181+
"sudo chmod +x /var/lib/cloud/scripts/per-boot/start-runner.sh",
182+
]
183+
}
184+
185+
}

modules/runner-binaries-syncer/lambdas/runner-binaries-syncer/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@
1818
"@octokit/rest": "^18.12.0",
1919
"@trivago/prettier-plugin-sort-imports": "^3.2.0",
2020
"@types/jest": "^27.5.0",
21-
"@types/node": "^18.0.0",
21+
"@types/node": "^18.0.1",
2222
"@types/request": "^2.48.8",
2323
"@typescript-eslint/eslint-plugin": "^4.33.0",
2424
"@typescript-eslint/parser": "^4.33.0",
2525
"@vercel/ncc": "^0.34.0",
26-
"aws-sdk": "^2.1163.0",
26+
"aws-sdk": "^2.1167.0",
2727
"eslint": "^7.32.0",
28-
"eslint-plugin-prettier": "4.1.0",
28+
"eslint-plugin-prettier": "4.2.1",
2929
"jest": "^27.5.1",
3030
"jest-mock": "^28.1.1",
3131
"prettier": "2.7.1",

modules/runner-binaries-syncer/lambdas/runner-binaries-syncer/yarn.lock

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -897,10 +897,10 @@
897897
resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.9.tgz#97edc9037ea0c38585320b28964dde3b39e4660d"
898898
integrity sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ==
899899

900-
"@types/node@*", "@types/node@^18.0.0":
901-
version "18.0.0"
902-
resolved "https://registry.yarnpkg.com/@types/node/-/node-18.0.0.tgz#67c7b724e1bcdd7a8821ce0d5ee184d3b4dd525a"
903-
integrity sha512-cHlGmko4gWLVI27cGJntjs/Sj8th9aYwplmZFwmmgYQQvL5NUsgVJG7OddLvNfLqYS31KFN0s3qlaD9qCaxACA==
900+
"@types/node@*", "@types/node@^18.0.1":
901+
version "18.0.1"
902+
resolved "https://registry.yarnpkg.com/@types/node/-/node-18.0.1.tgz#e91bd73239b338557a84d1f67f7b9e0f25643870"
903+
integrity sha512-CmR8+Tsy95hhwtZBKJBs0/FFq4XX7sDZHlGGf+0q+BRZfMbOTkzkj0AFAuTyXbObDIoanaBBW0+KEW+m3N16Wg==
904904

905905
"@types/prettier@^2.1.5":
906906
version "2.4.2"
@@ -1172,10 +1172,10 @@ asynckit@^0.4.0:
11721172
resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79"
11731173
integrity sha1-x57Zf380y48robyXkLzDZkdLS3k=
11741174

1175-
aws-sdk@^2.1163.0:
1176-
version "2.1163.0"
1177-
resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.1163.0.tgz#2c24b82987c6a842d9bec8a0d61a13cb36b26bba"
1178-
integrity sha512-vSCPTNduqxv5cGe3al/0V6dxPr+hpDRR7B9AADtVp+iHS+HdLCeNZbGhT66VfFjXVXXEfbAuF4ME9fYSc5/mOg==
1175+
aws-sdk@^2.1167.0:
1176+
version "2.1167.0"
1177+
resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.1167.0.tgz#e8614bce1a7355782734b6928792f14d11b39231"
1178+
integrity sha512-hUJzAqWVfNYpct1S+GjyPIc2s+GZcAhbWVqIG4qbLYZ3+sBTcjv3lLH5zx7K+qcTGINDU0g4EsMi6hIrAU+blg==
11791179
dependencies:
11801180
buffer "4.9.2"
11811181
events "1.1.1"
@@ -1645,10 +1645,10 @@ escodegen@^2.0.0:
16451645
optionalDependencies:
16461646
source-map "~0.6.1"
16471647

1648-
eslint-plugin-prettier@4.1.0:
1649-
version "4.1.0"
1650-
resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-4.1.0.tgz#1cd4b3fadf3b3cdb30b1874b55e7f93f85eb43ad"
1651-
integrity sha512-A3AXIEfTnq3D5qDFjWJdQ9c4BLhw/TqhSR+6+SVaoPJBAWciFEuJiNQh275OnjRrAi7yssZzuWBRw66VG2g6UA==
1648+
eslint-plugin-prettier@4.2.1:
1649+
version "4.2.1"
1650+
resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-4.2.1.tgz#651cbb88b1dab98bfd42f017a12fa6b2d993f94b"
1651+
integrity sha512-f/0rXLXUt0oFYs8ra4w49wYZBG5GKZpAYsJSm6rnYL5uVDjd+zowwMwVZHnAjf4edNrKpCDYfXDgmRE/Ak7QyQ==
16521652
dependencies:
16531653
prettier-linter-helpers "^1.0.0"
16541654

modules/runners/lambdas/runners/package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,27 +24,27 @@
2424
"@typescript-eslint/parser": "^4.33.0",
2525
"@vercel/ncc": "^0.34.0",
2626
"eslint": "^7.32.0",
27-
"eslint-plugin-prettier": "4.1.0",
27+
"eslint-plugin-prettier": "4.2.1",
2828
"jest": "27.5.1",
2929
"jest-mock": "^28.1.1",
3030
"jest-mock-extended": "^2.0.6",
3131
"moment-timezone": "^0.5.34",
32-
"nock": "^13.2.7",
32+
"nock": "^13.2.8",
3333
"prettier": "2.7.1",
3434
"ts-jest": "^27.1.4",
35-
"ts-node": "^10.7.0",
35+
"ts-node": "^10.8.2",
3636
"ts-node-dev": "^2.0.0"
3737
},
3838
"dependencies": {
39-
"@aws-sdk/client-ssm": "^3.118.0",
39+
"@aws-sdk/client-ssm": "^3.121.0",
4040
"@octokit/auth-app": "3.6.1",
4141
"@octokit/rest": "^18.12.0",
4242
"@octokit/types": "^6.38.1",
4343
"@types/aws-lambda": "^8.10.101",
4444
"@types/express": "^4.17.11",
45-
"@types/node": "^18.0.0",
46-
"aws-sdk": "^2.1163.0",
47-
"cron-parser": "^4.4.0",
45+
"@types/node": "^18.0.1",
46+
"aws-sdk": "^2.1167.0",
47+
"cron-parser": "^4.5.0",
4848
"tslog": "^3.3.3",
4949
"typescript": "^4.7.4"
5050
}

0 commit comments

Comments
 (0)