Skip to content

Commit

Permalink
feat: add dynamic pool and disable daily upgrades
Browse files Browse the repository at this point in the history
  • Loading branch information
galargh committed May 21, 2024
1 parent 5b338f2 commit 675289d
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,5 @@ main_override.*._tf

.env
.env.*

*.pem
Binary file modified bootstrap/runners.zip
Binary file not shown.
3 changes: 2 additions & 1 deletion images/ubuntu-jammy/default.pkrvars.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ custom_shell_commands = [
"sudo apt-get -y install build-essential docker-compose-plugin default-jdk cmake libclang-dev",
"sudo apt remove unattended-upgrades -y",
"sudo sed -i 's/^\\(APT::Periodic::Update-Package-Lists\\) \"1\";/\\1 \"0\";/' /etc/apt/apt.conf.d/10periodic",
"sudo systemctl mask apt-daily.service apt-daily-upgrade.service",
"curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg",
"sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg",
"echo \"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main\" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null",
Expand All @@ -17,4 +18,4 @@ post_install_custom_shell_commands = []

name_suffix = "default"

runner_architecture = "arm64"
runner_architecture = "x64"
2 changes: 1 addition & 1 deletion images/ubuntu-jammy/github_agent.ubuntu.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ variable "post_install_custom_shell_commands" {
variable "runner_version" {
description = "The version (no v prefix) of the runner software to install https://github.com/actions/runner/releases"
type = string
default = "2.312.0"
default = "2.316.1"
}

variable "runner_architecture" {
Expand Down
8 changes: 8 additions & 0 deletions runners.tf
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ locals {
runners = {for v in values(module.multi-runner.runners_map) : replace(v.launch_template_name, "-action-runner$", "") => {
role_runner_id = v.role_runner.id
}}
runner_owners = distinct([for repository in var.repository_white_list: split("/", repository)[0]])
}

module "multi-runner" {
Expand Down Expand Up @@ -358,6 +359,13 @@ module "multi-runner" {
"ghr:ipdx:s3_bucket_prefix": "multi-${k}-action-runner"
}

pool_runner_owner = join(",", local.runner_owners)
pool_config = [{
size = -1
# https://crontab.guru/every-30-minutes
schedule_expression = "cron(0/45 * * * ? *)"
}]

ami_filter = lookup(v, "ami_filter", null)
ami_owners = lookup(v, "ami_owners", ["amazon"])
enable_userdata = lookup(v, "enable_userdata", true)
Expand Down

0 comments on commit 675289d

Please sign in to comment.