Skip to content

Commit d7a3444

Browse files
authored
Merge branch 'main' into feat/dynamic-pool
2 parents 17e986d + 1e40ecd commit d7a3444

File tree

9 files changed

+48
-13
lines changed

9 files changed

+48
-13
lines changed

.github/workflows/update-docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
# change docs via PR in case of locked main branch
5252
- name: Create Pull Request (main branch only)
5353
if: github.ref == 'refs/heads/main' && github.repository_owner == 'philips-labs'
54-
uses: peter-evans/create-pull-request@70a41aba780001da0a30141984ae2a0c95d8704e # ratchet:peter-evans/[email protected].2
54+
uses: peter-evans/create-pull-request@c55203cfde3e5c11a452d352b4393e68b85b4533 # ratchet:peter-evans/[email protected].3
5555
with:
5656
token: ${{ secrets.GITHUB_TOKEN }}
5757
commit-message: "docs: auto update terraform docs"

CHANGELOG.md

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

3+
## [5.10.0](https://github.com/philips-labs/terraform-aws-github-runner/compare/v5.9.0...v5.10.0) (2024-04-17)
4+
5+
6+
### Features
7+
8+
* add spot termination watcher (beta) ([#3789](https://github.com/philips-labs/terraform-aws-github-runner/issues/3789)) ([b2dc794](https://github.com/philips-labs/terraform-aws-github-runner/commit/b2dc794f08c932470dae846dad0e0a5f33a68cc4))
9+
* allow caller to provide custom userdata ([#3798](https://github.com/philips-labs/terraform-aws-github-runner/issues/3798)) ([ac49daf](https://github.com/philips-labs/terraform-aws-github-runner/commit/ac49daf4afb14b6710d2d652bc2c0f51fc2af98f))
10+
* Allow to disable runner max scaling check ([#3849](https://github.com/philips-labs/terraform-aws-github-runner/issues/3849)) ([e05a043](https://github.com/philips-labs/terraform-aws-github-runner/commit/e05a043b7354f42f391a1b5319bc850d4e8b2c02))
11+
12+
13+
### Bug Fixes
14+
15+
* **lambda:** bump axios from 1.6.7 to 1.6.8 in /lambdas ([#3814](https://github.com/philips-labs/terraform-aws-github-runner/issues/3814)) ([513b22f](https://github.com/philips-labs/terraform-aws-github-runner/commit/513b22f6291d9437aae41367098096ca6377547b))
16+
* **lambda:** bump the aws group in /lambdas with 5 updates ([#3834](https://github.com/philips-labs/terraform-aws-github-runner/issues/3834)) ([e7e56ea](https://github.com/philips-labs/terraform-aws-github-runner/commit/e7e56ea9466feedec46c41f0834ebfd05e6f512f))
17+
* **lambda:** bump the aws group in /lambdas with 5 updates ([#3846](https://github.com/philips-labs/terraform-aws-github-runner/issues/3846)) ([9303a10](https://github.com/philips-labs/terraform-aws-github-runner/commit/9303a108dfd12ff0c63e7aeb55aa814c7f14619c))
18+
* **lambda:** bump the aws group in /lambdas with 6 updates ([#3818](https://github.com/philips-labs/terraform-aws-github-runner/issues/3818)) ([9a9031e](https://github.com/philips-labs/terraform-aws-github-runner/commit/9a9031ead20546f6a3b939435a801e5aeb8264b8))
19+
320
## [5.9.0](https://github.com/philips-labs/terraform-aws-github-runner/compare/v5.8.0...v5.9.0) (2024-03-14)
421

522

lambdas/functions/control-plane/src/scale-runners/scale-up.test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,14 @@ describe('scaleUp with GHES', () => {
241241
expect(mockOctokit.actions.createRegistrationTokenForRepo).not.toBeCalled();
242242
});
243243

244+
it('does create a runner if maximum is set to -1', async () => {
245+
process.env.RUNNERS_MAXIMUM_COUNT = '-1';
246+
process.env.ENABLE_EPHEMERAL_RUNNERS = 'false';
247+
await scaleUpModule.scaleUp('aws:sqs', TEST_DATA);
248+
expect(listEC2Runners).not.toHaveBeenCalled();
249+
expect(createRunner).toHaveBeenCalled();
250+
});
251+
244252
it('creates a token when maximum runners has not been reached', async () => {
245253
process.env.ENABLE_EPHEMERAL_RUNNERS = 'false';
246254
await scaleUpModule.scaleUp('aws:sqs', TEST_DATA);

lambdas/functions/control-plane/src/scale-runners/scale-up.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -277,14 +277,18 @@ export async function scaleUp(eventSource: string, payload: ActionRequestMessage
277277
const ghAuth = await createGithubInstallationAuth(installationId, ghesApiUrl);
278278
const githubInstallationClient = await createOctoClient(ghAuth.token, ghesApiUrl);
279279
if (!enableJobQueuedCheck || (await isJobQueued(githubInstallationClient, payload))) {
280-
const currentRunners = await listEC2Runners({
281-
environment,
282-
runnerType,
283-
runnerOwner,
284-
});
285-
logger.info(`Current runners: ${currentRunners.length} of ${maximumRunners}`);
280+
let scaleUp = true;
281+
if (maximumRunners !== -1) {
282+
const currentRunners = await listEC2Runners({
283+
environment,
284+
runnerType,
285+
runnerOwner,
286+
});
287+
logger.info(`Current runners: ${currentRunners.length} of ${maximumRunners}`);
288+
scaleUp = currentRunners.length < maximumRunners;
289+
}
286290

287-
if (currentRunners.length < maximumRunners) {
291+
if (scaleUp) {
288292
logger.info(`Attempting to launch a new runner`);
289293

290294
await createRunners(

modules/multi-runner/README.md

Lines changed: 2 additions & 1 deletion
Large diffs are not rendered by default.

modules/multi-runner/queues.tf

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ data "aws_iam_policy_document" "deny_unsecure_transport" {
2626
}
2727
}
2828

29-
3029
resource "aws_sqs_queue" "queued_builds" {
3130
for_each = var.multi_runner_config
3231
name = "${var.prefix}-${each.key}-queued-builds${each.value.fifo ? ".fifo" : ""}"
@@ -71,6 +70,12 @@ resource "aws_sqs_queue_policy" "build_queue_dlq_policy" {
7170
policy = data.aws_iam_policy_document.deny_unsecure_transport.json
7271
}
7372

73+
resource "aws_sqs_queue_policy" "webhook_events_workflow_job_queue_policy" {
74+
count = var.enable_workflow_job_events_queue ? 1 : 0
75+
queue_url = aws_sqs_queue.webhook_events_workflow_job_queue[0].id
76+
policy = data.aws_iam_policy_document.deny_unsecure_transport.json
77+
}
78+
7479
resource "aws_sqs_queue" "webhook_events_workflow_job_queue" {
7580
count = var.enable_workflow_job_events_queue ? 1 : 0
7681
name = "${var.prefix}-webhook_events_workflow_job_queue"

modules/multi-runner/variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ variable "multi_runner_config" {
160160
runner_group_name: "Name of the runner group."
161161
runner_name_prefix: "Prefix for the GitHub runner name."
162162
runner_run_as: "Run the GitHub actions agent as user."
163-
runners_maximum_count: "The maximum number of runners that will be created."
163+
runners_maximum_count: "The maximum number of runners that will be created. Setting the variable to `-1` desiables the maximum check."
164164
scale_down_schedule_expression: "Scheduler expression to check every x for scale down."
165165
scale_up_reserved_concurrent_executions: "Amount of reserved concurrent executions for the scale-up lambda function. A value of 0 disables lambda from being triggered and -1 removes any concurrency limitations."
166166
userdata_template: "Alternative user-data template, replacing the default template. By providing your own user_data you have to take care of installing all required software, including the action runner. Variables userdata_pre/post_install are ignored."

modules/runners/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ yarn run dist
204204
| <a name="input_runner_run_as"></a> [runner\_run\_as](#input\_runner\_run\_as) | Run the GitHub actions agent as user. | `string` | `"ec2-user"` | no |
205205
| <a name="input_runners_lambda_s3_key"></a> [runners\_lambda\_s3\_key](#input\_runners\_lambda\_s3\_key) | S3 key for runners lambda function. Required if using S3 bucket to specify lambdas. | `string` | `null` | no |
206206
| <a name="input_runners_lambda_s3_object_version"></a> [runners\_lambda\_s3\_object\_version](#input\_runners\_lambda\_s3\_object\_version) | S3 object version for runners lambda function. Useful if S3 versioning is enabled on source bucket. | `string` | `null` | no |
207-
| <a name="input_runners_maximum_count"></a> [runners\_maximum\_count](#input\_runners\_maximum\_count) | The maximum number of runners that will be created. | `number` | `3` | no |
207+
| <a name="input_runners_maximum_count"></a> [runners\_maximum\_count](#input\_runners\_maximum\_count) | The maximum number of runners that will be created. Setting the variable to `-1` desiables the maximum check. | `number` | `3` | no |
208208
| <a name="input_s3_runner_binaries"></a> [s3\_runner\_binaries](#input\_s3\_runner\_binaries) | Bucket details for cached GitHub binary. | <pre>object({<br> arn = string<br> id = string<br> key = string<br> })</pre> | n/a | yes |
209209
| <a name="input_scale_down_schedule_expression"></a> [scale\_down\_schedule\_expression](#input\_scale\_down\_schedule\_expression) | Scheduler expression to check every x for scale down. | `string` | `"cron(*/5 * * * ? *)"` | no |
210210
| <a name="input_scale_up_reserved_concurrent_executions"></a> [scale\_up\_reserved\_concurrent\_executions](#input\_scale\_up\_reserved\_concurrent\_executions) | Amount of reserved concurrent executions for the scale-up lambda function. A value of 0 disables lambda from being triggered and -1 removes any concurrency limitations. | `number` | `1` | no |

modules/runners/variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ variable "runner_run_as" {
288288
}
289289

290290
variable "runners_maximum_count" {
291-
description = "The maximum number of runners that will be created."
291+
description = "The maximum number of runners that will be created. Setting the variable to `-1` desiables the maximum check."
292292
type = number
293293
default = 3
294294
}

0 commit comments

Comments
 (0)