Skip to content

Commit d394d35

Browse files
committed
Merge branch 'release/v0.10.0' into master
2 parents 8874635 + 4a4c5c2 commit d394d35

File tree

18 files changed

+201
-118
lines changed

18 files changed

+201
-118
lines changed

CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [0.10.0] - 2021-01-27
11+
12+
### Added
13+
14+
- Support runner groups (#496)
15+
1016
## [0.9.1] - 2021-01-22
1117

1218
### Fixed
@@ -145,7 +151,8 @@ terraform import module.runners.module.webhook.aws_cloudwatch_log_group.webhook
145151

146152
- First release.
147153

148-
[unreleased]: https://github.com/philips-labs/terraform-aws-github-runner/compare/v0.9.1..HEAD
154+
[unreleased]: https://github.com/philips-labs/terraform-aws-github-runner/compare/v0.10.0..HEAD
155+
[0.10.0]: https://github.com/philips-labs/terraform-aws-github-runner/releases/tag/v0.9.1..v00.10.0
149156
[0.9.1]: https://github.com/philips-labs/terraform-aws-github-runner/releases/tag/v0.9.0..v0.9.1
150157
[0.9.0]: https://github.com/philips-labs/terraform-aws-github-runner/releases/tag/v0.8.1..v0.9.0
151158
[0.8.1]: https://github.com/philips-labs/terraform-aws-github-runner/releases/tag/v0.9.0..v0.8.1

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ To apply the terraform module, the compiled lambdas (.zip files) need to be avai
113113

114114
To read the files from S3, set the `lambda_s3_bucket` variable and the specific object key for each lambda.
115115

116-
The lambdas can be downloaded maually from the [release page](https://github.com/philips-labs/terraform-aws-github-runner/releases) or using the [download-lambda](./modules/download-lambda) terraform module (requires `curl` to be installed on your machine). In the `download-lambda` directory, run `terraform init && terraform apply`. The lambdas will be saved to the same directory.
116+
The lambdas can be downloaded manually from the [release page](https://github.com/philips-labs/terraform-aws-github-runner/releases) or using the [download-lambda](./modules/download-lambda) terraform module (requires `curl` to be installed on your machine). In the `download-lambda` directory, run `terraform init && terraform apply`. The lambdas will be saved to the same directory.
117117

118118
For local development you can build all the lambdas at once using `.ci/build.sh` or individually using `yarn dist`.
119119

@@ -136,7 +136,7 @@ Note that `github_app.key_base64` needs to be the base64-encoded `.pem` file, i.
136136
```terraform
137137
module "github-runner" {
138138
source = "philips-labs/github-runner/aws"
139-
version = "0.8.0"
139+
version = "0.9.1"
140140
141141
aws_region = "eu-west-1"
142142
vpc_id = "vpc-123"
@@ -336,6 +336,7 @@ No requirements.
336336
| runner\_binaries\_syncer\_lambda\_timeout | Time out of the binaries sync lambda in seconds. | `number` | `300` | no |
337337
| runner\_binaries\_syncer\_lambda\_zip | File location of the binaries sync lambda zip file. | `string` | `null` | no |
338338
| runner\_extra\_labels | Extra labels for the runners (GitHub). Separate each label by a comma | `string` | `""` | no |
339+
| runner\_group\_name | Name of the runner group. | `string` | `"Default"` | no |
339340
| runner\_iam\_role\_managed\_policy\_arns | Attach AWS or customer-managed IAM policies (by ARN) to the runner IAM role | `list(string)` | `[]` | no |
340341
| runner\_log\_files | (optional) Replaces the module default cloudwatch log config. See https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Agent-Configuration-File-Details.html for details. | <pre>list(object({<br> log_group_name = string<br> prefix_log_group = bool<br> file_path = string<br> log_stream_name = string<br> }))</pre> | <pre>[<br> {<br> "file_path": "/var/log/messages",<br> "log_group_name": "messages",<br> "log_stream_name": "{instance_id}",<br> "prefix_log_group": true<br> },<br> {<br> "file_path": "/var/log/user-data.log",<br> "log_group_name": "user_data",<br> "log_stream_name": "{instance_id}",<br> "prefix_log_group": true<br> },<br> {<br> "file_path": "/home/ec2-user/actions-runner/_diag/Runner_**.log",<br> "log_group_name": "runner",<br> "log_stream_name": "{instance_id}",<br> "prefix_log_group": true<br> }<br>]</pre> | no |
341342
| runners\_lambda\_s3\_key | S3 key for runners lambda function. Required if using S3 bucket to specify lambdas. | `any` | `null` | no |

examples/default/lambdas-download/main.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ module "lambdas" {
33
lambdas = [
44
{
55
name = "webhook"
6-
tag = "v0.9.1"
6+
tag = "v0.10.0"
77
},
88
{
99
name = "runners"
10-
tag = "v0.9.1"
10+
tag = "v0.10.0"
1111
},
1212
{
1313
name = "runner-binaries-syncer"
14-
tag = "v0.9.1"
14+
tag = "v0.10.0"
1515
}
1616
]
1717
}

examples/permissions-boundary/lambdas-download/main.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ module "lambdas" {
33
lambdas = [
44
{
55
name = "webhook"
6-
tag = "v0.9.1"
6+
tag = "v0.10.0"
77
},
88
{
99
name = "runners"
10-
tag = "v0.9.1"
10+
tag = "v0.10.0"
1111
},
1212
{
1313
name = "runner-binaries-syncer"
14-
tag = "v0.9.1"
14+
tag = "v0.10.0"
1515
}
1616
]
1717
}

modules/download-lambda/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ module "lambdas" {
1010
lambdas = [
1111
{
1212
name = "webhook"
13-
tag = "v0.9.1"
13+
tag = "v0.10.0"
1414
},
1515
{
1616
name = "runners"
17-
tag = "v0.9.1"
17+
tag = "v0.10.0"
1818
},
1919
{
2020
name = "runner-binaries-syncer"
21-
tag = "v0.9.1"
21+
tag = "v0.10.0"
2222
}
2323
]
2424
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@
1515
"format-check": "prettier --check \"**/*.ts\""
1616
},
1717
"devDependencies": {
18-
"@octokit/rest": "^18.0.12",
18+
"@octokit/rest": "^18.0.14",
1919
"@types/jest": "^26.0.20",
20-
"@types/node": "^14.14.21",
20+
"@types/node": "^14.14.22",
2121
"@types/request": "^2.48.4",
2222
"@typescript-eslint/eslint-plugin": "^4.0.0",
2323
"@typescript-eslint/parser": "^3.10.1",
2424
"@zeit/ncc": "^0.22.1",
25-
"aws-sdk": "^2.828.0",
25+
"aws-sdk": "^2.831.0",
2626
"eslint": "^7.18.0",
2727
"jest": "^26.6.3",
2828
"ts-jest": "^26.4.4",

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

Lines changed: 32 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,11 @@
544544
resolved "https://registry.yarnpkg.com/@octokit/openapi-types/-/openapi-types-2.0.0.tgz#6d8f8ad9db3b75a39115f5def2654df8bed39f28"
545545
integrity sha512-J4bfM7lf8oZvEAdpS71oTvC1ofKxfEZgU5vKVwzZKi4QPiL82udjpseJwxPid9Pu2FNmyRQOX4iEj6W1iOSnPw==
546546

547+
"@octokit/openapi-types@^3.2.0":
548+
version "3.2.0"
549+
resolved "https://registry.yarnpkg.com/@octokit/openapi-types/-/openapi-types-3.2.0.tgz#d62d0ff7147dbf4d218616b2484ee2a5d023055d"
550+
integrity sha512-X7yW/fpzF3uTAE+LbPD3HEeeU+/49o0V4kNA/yv8jQ3BDpFayv/osTOhY1y1mLXljW2bOJcOCSGZo4jFKPJ6Vw==
551+
547552
"@octokit/plugin-paginate-rest@^2.6.2":
548553
version "2.6.2"
549554
resolved "https://registry.yarnpkg.com/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.6.2.tgz#45d13dbf5ff8aed54f1a3716b1d57fdc62720c5f"
@@ -556,12 +561,12 @@
556561
resolved "https://registry.yarnpkg.com/@octokit/plugin-request-log/-/plugin-request-log-1.0.2.tgz#394d59ec734cd2f122431fbaf05099861ece3c44"
557562
integrity sha512-oTJSNAmBqyDR41uSMunLQKMX0jmEXbwD1fpz8FG27lScV3RhtGfBa1/BBLym+PxcC16IBlF7KH9vP1BUYxA+Eg==
558563

559-
"@octokit/plugin-rest-endpoint-methods@4.4.1":
560-
version "4.4.1"
561-
resolved "https://registry.yarnpkg.com/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-4.4.1.tgz#105cf93255432155de078c9efc33bd4e14d1cd63"
562-
integrity sha512-+v5PcvrUcDeFXf8hv1gnNvNLdm4C0+2EiuWt9EatjjUmfriM1pTMM+r4j1lLHxeBQ9bVDmbywb11e3KjuavieA==
564+
"@octokit/plugin-rest-endpoint-methods@4.8.0":
565+
version "4.8.0"
566+
resolved "https://registry.yarnpkg.com/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-4.8.0.tgz#c1f24f940fc265f0021c8f544e3d8755f3253759"
567+
integrity sha512-2zRpXDveJH8HsXkeeMtRW21do8wuSxVn1xXFdvhILyxlLWqGQrdJUA1/dk5DM7iAAYvwT/P3bDOLs90yL4S2AA==
563568
dependencies:
564-
"@octokit/types" "^6.1.0"
569+
"@octokit/types" "^6.5.0"
565570
deprecation "^2.3.1"
566571

567572
"@octokit/request-error@^2.0.0":
@@ -601,15 +606,15 @@
601606
once "^1.4.0"
602607
universal-user-agent "^6.0.0"
603608

604-
"@octokit/rest@^18.0.12":
605-
version "18.0.12"
606-
resolved "https://registry.yarnpkg.com/@octokit/rest/-/rest-18.0.12.tgz#278bd41358c56d87c201e787e8adc0cac132503a"
607-
integrity sha512-hNRCZfKPpeaIjOVuNJzkEL6zacfZlBPV8vw8ReNeyUkVvbuCvvrrx8K8Gw2eyHHsmd4dPlAxIXIZ9oHhJfkJpw==
609+
"@octokit/rest@^18.0.14":
610+
version "18.0.14"
611+
resolved "https://registry.yarnpkg.com/@octokit/rest/-/rest-18.0.14.tgz#a152478465746542e80697b5a5576ccb6151dc4d"
612+
integrity sha512-62mKIaBb/XD2Z2KCBmAPydEk/d0IBMOnwk6DJVo36ICTnxlRPTdQwFE2LzlpBPDR52xOKPlGqb3Bnhh99atltA==
608613
dependencies:
609614
"@octokit/core" "^3.2.3"
610615
"@octokit/plugin-paginate-rest" "^2.6.2"
611616
"@octokit/plugin-request-log" "^1.0.2"
612-
"@octokit/plugin-rest-endpoint-methods" "4.4.1"
617+
"@octokit/plugin-rest-endpoint-methods" "4.8.0"
613618

614619
"@octokit/types@^5.0.0", "@octokit/types@^5.0.1":
615620
version "5.2.0"
@@ -618,14 +623,22 @@
618623
dependencies:
619624
"@types/node" ">= 8"
620625

621-
"@octokit/types@^6.0.0", "@octokit/types@^6.0.1", "@octokit/types@^6.0.3", "@octokit/types@^6.1.0":
626+
"@octokit/types@^6.0.0", "@octokit/types@^6.0.1", "@octokit/types@^6.0.3":
622627
version "6.1.1"
623628
resolved "https://registry.yarnpkg.com/@octokit/types/-/types-6.1.1.tgz#bc88b3eb5f447b025a2a1a8177a72db216e8d4ca"
624629
integrity sha512-btm3D6S7VkRrgyYF31etUtVY/eQ1KzrNRqhFt25KSe2mKlXuLXJilglRC6eDA2P6ou94BUnk/Kz5MPEolXgoiw==
625630
dependencies:
626631
"@octokit/openapi-types" "^2.0.0"
627632
"@types/node" ">= 8"
628633

634+
"@octokit/types@^6.5.0":
635+
version "6.5.0"
636+
resolved "https://registry.yarnpkg.com/@octokit/types/-/types-6.5.0.tgz#8f27c52d57eb4096fb05a290f4afc90194e08b19"
637+
integrity sha512-mzCy7lkYQv+kM58W37uTg/mWoJ4nvRDRCkjSdqlrgA28hJEYNJTMYiGTvmq39cdtnMPJd0hshysBEAaH4D5C7w==
638+
dependencies:
639+
"@octokit/openapi-types" "^3.2.0"
640+
"@types/node" ">= 8"
641+
629642
"@sinonjs/commons@^1.7.0":
630643
version "1.8.1"
631644
resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-1.8.1.tgz#e7df00f98a203324f6dc7cc606cad9d4a8ab2217"
@@ -734,10 +747,10 @@
734747
resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.5.tgz#dcce4430e64b443ba8945f0290fb564ad5bac6dd"
735748
integrity sha512-7+2BITlgjgDhH0vvwZU/HZJVyk+2XUlvxXe8dFMedNX/aMkaOq++rMAFXc0tM7ij15QaWlbdQASBR9dihi+bDQ==
736749

737-
"@types/node@*", "@types/node@>= 8", "@types/node@^14.14.21":
738-
version "14.14.21"
739-
resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.21.tgz#d934aacc22424fe9622ebf6857370c052eae464e"
740-
integrity sha512-cHYfKsnwllYhjOzuC5q1VpguABBeecUp24yFluHpn/BQaVxB1CuQ1FSRZCzrPxrkIfWISXV2LbeoBthLWg0+0A==
750+
"@types/node@*", "@types/node@>= 8", "@types/node@^14.14.22":
751+
version "14.14.22"
752+
resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.22.tgz#0d29f382472c4ccf3bd96ff0ce47daf5b7b84b18"
753+
integrity sha512-g+f/qj/cNcqKkc3tFqlXOYjrmZA+jNBiDzbP3kH+B+otKFqAdPgVTGP1IeKRdMml/aE69as5S4FqtxAbl+LaMw==
741754

742755
"@types/normalize-package-data@^2.4.0":
743756
version "2.4.0"
@@ -1069,10 +1082,10 @@ atob@^2.1.2:
10691082
resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9"
10701083
integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==
10711084

1072-
aws-sdk@^2.828.0:
1073-
version "2.828.0"
1074-
resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.828.0.tgz#6aa599c3582f219568f41fb287eb65753e4a9234"
1075-
integrity sha512-JoDujGdncSIF9ka+XFZjop/7G+fNGucwPwYj7OHYMmFIOV5p7YmqomdbVmH/vIzd988YZz8oLOinWc4jM6vvhg==
1085+
aws-sdk@^2.831.0:
1086+
version "2.831.0"
1087+
resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.831.0.tgz#02607cc911a2136e5aabe624c1282e821830aef2"
1088+
integrity sha512-lrOjbGFpjk2xpESyUx2PGsTZgptCy5xycZazPeakNbFO19cOoxjHx3xyxOHsMCYb3pQwns35UvChQT60B4u6cw==
10761089
dependencies:
10771090
buffer "4.9.2"
10781091
events "1.1.1"

modules/runners/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,9 @@ No requirements.
9595
| runner\_architecture | The platform architecture of the runner instance\_type. | `string` | `"x64"` | no |
9696
| runner\_as\_root | Run the action runner under the root user. | `bool` | `false` | no |
9797
| runner\_extra\_labels | Extra labels for the runners (GitHub). Separate each label by a comma | `string` | `""` | no |
98+
| runner\_group\_name | Name of the runner group. | `string` | `"Default"` | no |
9899
| runner\_iam\_role\_managed\_policy\_arns | Attach AWS or customer-managed IAM policies (by ARN) to the runner IAM role | `list(string)` | `[]` | no |
99-
| runner\_log\_files | (optional) List of logfiles to send to cloudwatch, will onlybe usded if `enable_cloudwatch_agent` is set to true. Object description: `log_group_name`: Name of the log group, `prefix_log_group`: module will prefix the log group with `/github-self-hosted-runners/<var.environment>`, `file_path`: path to the log file, `log_stream_name`: name of the log stream. | <pre>list(object({<br> log_group_name = string<br> prefix_log_group = bool<br> file_path = string<br> log_stream_name = string<br> }))</pre> | <pre>[<br> {<br> "file_path": "/var/log/messages",<br> "log_group_name": "messages",<br> "log_stream_name": "{instance_id}",<br> "prefix_log_group": true<br> },<br> {<br> "file_path": "/var/log/user-data.log",<br> "log_group_name": "user_data",<br> "log_stream_name": "{instance_id}",<br> "prefix_log_group": true<br> },<br> {<br> "file_path": "/home/ec2-user/actions-runner/_diag/Runner_**.log",<br> "log_group_name": "runner",<br> "log_stream_name": "{instance_id}",<br> "prefix_log_group": true<br> }<br>]</pre> | no |
100+
| runner\_log\_files | (optional) List of logfiles to send to cloudwatch, will only be used if `enable_cloudwatch_agent` is set to true. Object description: `log_group_name`: Name of the log group, `prefix_log_group`: If true, the log group name will be prefixed with `/github-self-hosted-runners/<var.environment>`, `file_path`: path to the log file, `log_stream_name`: name of the log stream. | <pre>list(object({<br> log_group_name = string<br> prefix_log_group = bool<br> file_path = string<br> log_stream_name = string<br> }))</pre> | <pre>[<br> {<br> "file_path": "/var/log/messages",<br> "log_group_name": "messages",<br> "log_stream_name": "{instance_id}",<br> "prefix_log_group": true<br> },<br> {<br> "file_path": "/var/log/user-data.log",<br> "log_group_name": "user_data",<br> "log_stream_name": "{instance_id}",<br> "prefix_log_group": true<br> },<br> {<br> "file_path": "/home/ec2-user/actions-runner/_diag/Runner_**.log",<br> "log_group_name": "runner",<br> "log_stream_name": "{instance_id}",<br> "prefix_log_group": true<br> }<br>]</pre> | no |
100101
| runners\_lambda\_s3\_key | S3 key for runners lambda function. Required if using S3 bucket to specify lambdas. | `any` | `null` | no |
101102
| runners\_lambda\_s3\_object\_version | S3 object version for runners lambda function. Useful if S3 versioning is enabled on source bucket. | `any` | `null` | no |
102103
| runners\_maximum\_count | The maximum number of runners that will be created. | `number` | `3` | no |

modules/runners/lambdas/runners/package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,24 @@
1313
"format-check": "prettier --check \"**/*.ts\""
1414
},
1515
"devDependencies": {
16-
"@types/aws-lambda": "^8.10.70",
16+
"@types/aws-lambda": "^8.10.71",
1717
"@types/express": "^4.17.11",
1818
"@types/jest": "^26.0.20",
1919
"@vercel/ncc": "^0.27.0",
2020
"jest": "^26.6.3",
2121
"jest-mock-extended": "^1.0.10",
22-
"nock": "^13.0.5",
22+
"nock": "^13.0.6",
2323
"ts-jest": "^26.4.4",
2424
"ts-node-dev": "^1.1.1"
2525
},
2626
"dependencies": {
2727
"@octokit/auth-app": "^2.10.5",
28-
"@octokit/rest": "^18.0.12",
29-
"@octokit/types": "^6.3.2",
30-
"@types/aws-lambda": "^8.10.70",
28+
"@octokit/rest": "^18.0.14",
29+
"@octokit/types": "^6.5.0",
30+
"@types/aws-lambda": "^8.10.71",
3131
"@types/express": "^4.17.11",
32-
"@types/node": "^14.14.21",
33-
"aws-sdk": "^2.828.0",
32+
"@types/node": "^14.14.22",
33+
"aws-sdk": "^2.831.0",
3434
"cron-parser": "^2.18.0",
3535
"moment": "^2.29.1",
3636
"typescript": "^4.1.3",

modules/runners/lambdas/runners/src/lambda.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { scaleUp } from './scale-runners/scale-up';
22
import { scaleDown } from './scale-runners/scale-down';
3-
import { SQSEvent } from 'aws-lambda';
3+
import { SQSEvent, ScheduledEvent } from 'aws-lambda';
44

55
module.exports.scaleUp = async (event: SQSEvent, context: any, callback: any) => {
66
console.dir(event, { depth: 5 });
@@ -15,7 +15,7 @@ module.exports.scaleUp = async (event: SQSEvent, context: any, callback: any) =>
1515
}
1616
};
1717

18-
module.exports.scaleDown = async (event: any, context: any, callback: any) => {
18+
module.exports.scaleDown = async (event: ScheduledEvent, context: any, callback: any) => {
1919
try {
2020
scaleDown();
2121
return callback(null);

modules/runners/lambdas/runners/src/scale-runners/scale-up.test.ts

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,18 @@ describe('scaleUp with GHES', () => {
127127
repoName: undefined,
128128
});
129129
});
130+
131+
it('creates a runner with labels in s specific group', async () => {
132+
process.env.RUNNER_EXTRA_LABELS = 'label1,label2';
133+
process.env.RUNNER_GROUP_NAME = 'TEST_GROUP';
134+
await scaleUp('aws:sqs', TEST_DATA);
135+
expect(createRunner).toBeCalledWith({
136+
environment: 'unit-test-environment',
137+
runnerConfig: `--url https://github.enterprise.something/${TEST_DATA.repositoryOwner} --token 1234abcd --labels label1,label2 --runnergroup TEST_GROUP`,
138+
orgName: TEST_DATA.repositoryOwner,
139+
repoName: undefined,
140+
});
141+
});
130142
});
131143

132144
describe('on repo level', () => {
@@ -166,6 +178,18 @@ describe('scaleUp with GHES', () => {
166178
repoName: `${TEST_DATA.repositoryOwner}/${TEST_DATA.repositoryName}`,
167179
});
168180
});
181+
182+
it('creates a runner and ensure the group argument is ignored', async () => {
183+
process.env.RUNNER_EXTRA_LABELS = 'label1,label2';
184+
process.env.RUNNER_GROUP_NAME = 'TEST_GROUP_IGNORED';
185+
await scaleUp('aws:sqs', TEST_DATA);
186+
expect(createRunner).toBeCalledWith({
187+
environment: 'unit-test-environment',
188+
runnerConfig: `--url https://github.enterprise.something/${TEST_DATA.repositoryOwner}/${TEST_DATA.repositoryName} --token 1234abcd --labels label1,label2`,
189+
orgName: undefined,
190+
repoName: `${TEST_DATA.repositoryOwner}/${TEST_DATA.repositoryName}`,
191+
});
192+
});
169193
});
170194
});
171195

@@ -228,6 +252,18 @@ describe('scaleUp with public GH', () => {
228252
repoName: undefined,
229253
});
230254
});
255+
256+
it('creates a runner with labels in s specific group', async () => {
257+
process.env.RUNNER_EXTRA_LABELS = 'label1,label2';
258+
process.env.RUNNER_GROUP_NAME = 'TEST_GROUP';
259+
await scaleUp('aws:sqs', TEST_DATA);
260+
expect(createRunner).toBeCalledWith({
261+
environment: 'unit-test-environment',
262+
runnerConfig: `--url https://github.com/${TEST_DATA.repositoryOwner} --token 1234abcd --labels label1,label2 --runnergroup TEST_GROUP`,
263+
orgName: TEST_DATA.repositoryOwner,
264+
repoName: undefined,
265+
});
266+
});
231267
});
232268

233269
describe('on repo level', () => {
@@ -267,5 +303,17 @@ describe('scaleUp with public GH', () => {
267303
repoName: `${TEST_DATA.repositoryOwner}/${TEST_DATA.repositoryName}`,
268304
});
269305
});
306+
307+
it('creates a runner and ensure the group argument is ignored', async () => {
308+
process.env.RUNNER_EXTRA_LABELS = 'label1,label2';
309+
process.env.RUNNER_GROUP_NAME = 'TEST_GROUP_IGNORED';
310+
await scaleUp('aws:sqs', TEST_DATA);
311+
expect(createRunner).toBeCalledWith({
312+
environment: 'unit-test-environment',
313+
runnerConfig: `--url https://github.com/${TEST_DATA.repositoryOwner}/${TEST_DATA.repositoryName} --token 1234abcd --labels label1,label2`,
314+
orgName: undefined,
315+
repoName: `${TEST_DATA.repositoryOwner}/${TEST_DATA.repositoryName}`,
316+
});
317+
});
270318
});
271319
});

0 commit comments

Comments
 (0)