Skip to content

Commit 8cd43d6

Browse files
authored
Merge branch 'main' into main
2 parents 8120634 + fa5e83c commit 8cd43d6

File tree

19 files changed

+283
-114
lines changed

19 files changed

+283
-114
lines changed

CHANGELOG.md

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

3+
## [6.9.0](https://github.com/github-aws-runners/terraform-aws-github-runner/compare/v6.8.5...v6.9.0) (2025-11-13)
4+
5+
6+
### Features
7+
8+
* support multiple SSM parameters for large runner matcher configs ([#4790](https://github.com/github-aws-runners/terraform-aws-github-runner/issues/4790)) ([#4792](https://github.com/github-aws-runners/terraform-aws-github-runner/issues/4792)) ([4d4872f](https://github.com/github-aws-runners/terraform-aws-github-runner/commit/4d4872fd67a09f576743c04a8e342dd9350d160f))
9+
10+
11+
### Bug Fixes
12+
13+
* **lambda:** bump @octokit/rest from 22.0.0 to 22.0.1 in /lambdas in the octokit group ([#4876](https://github.com/github-aws-runners/terraform-aws-github-runner/issues/4876)) ([807aeef](https://github.com/github-aws-runners/terraform-aws-github-runner/commit/807aeefbe7d3fac452b29eb2b6efacc16c14e01c))
14+
* **lambda:** bump the aws group across 1 directory with 7 updates ([#4871](https://github.com/github-aws-runners/terraform-aws-github-runner/issues/4871)) ([8737fe2](https://github.com/github-aws-runners/terraform-aws-github-runner/commit/8737fe210beca5200170774534b0936fdbaa9942))
15+
* **lambda:** bump the aws-powertools group in /lambdas with 4 updates ([#4865](https://github.com/github-aws-runners/terraform-aws-github-runner/issues/4865)) ([8c76e12](https://github.com/github-aws-runners/terraform-aws-github-runner/commit/8c76e1223b1b976b74f30e57d2d73e207b7ac178))
16+
* **lambda:** bump the octokit group across 1 directory with 4 updates ([#4873](https://github.com/github-aws-runners/terraform-aws-github-runner/issues/4873)) ([39fc3cf](https://github.com/github-aws-runners/terraform-aws-github-runner/commit/39fc3cf45508ce28094c2c0a19cd7c39ba74299a))
17+
318
## [6.8.5](https://github.com/github-aws-runners/terraform-aws-github-runner/compare/v6.8.4...v6.8.5) (2025-11-02)
419

520

lambdas/functions/control-plane/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"@aws-sdk/types": "^3.921.0",
2121
"@octokit/types": "^16.0.0",
2222
"@types/aws-lambda": "^8.10.155",
23-
"@types/node": "^22.18.8",
23+
"@types/node": "^22.19.0",
2424
"@vercel/ncc": "^0.38.4",
2525
"aws-sdk-client-mock": "^4.1.0",
2626
"aws-sdk-client-mock-jest": "^4.1.0",

lambdas/functions/gh-agent-syncer/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"devDependencies": {
2020
"@aws-sdk/types": "^3.921.0",
2121
"@types/aws-lambda": "^8.10.155",
22-
"@types/node": "^22.18.8",
22+
"@types/node": "^22.19.0",
2323
"@types/request": "^2.48.13",
2424
"@vercel/ncc": "^0.38.4",
2525
"aws-sdk-client-mock": "^4.1.0",

lambdas/functions/termination-watcher/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"devDependencies": {
1818
"@aws-sdk/types": "^3.921.0",
1919
"@types/aws-lambda": "^8.10.155",
20-
"@types/node": "^22.18.8",
20+
"@types/node": "^22.19.0",
2121
"@vercel/ncc": "^0.38.4",
2222
"aws-sdk-client-mock": "^4.1.0",
2323
"aws-sdk-client-mock-jest": "^4.1.0"

lambdas/functions/webhook/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"@octokit/webhooks-types": "^7.6.1",
2222
"@types/aws-lambda": "^8.10.155",
2323
"@types/express": "^5.0.3",
24-
"@types/node": "^22.18.8",
24+
"@types/node": "^22.19.0",
2525
"@vercel/ncc": "0.38.4",
2626
"body-parser": "^2.2.0",
2727
"express": "^5.1.0",

lambdas/functions/webhook/src/ConfigLoader.test.ts

Lines changed: 75 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,54 @@ describe('ConfigLoader Tests', () => {
168168
'Failed to load config: Failed to load parameter for matcherConfig from path /path/to/matcher/config: Failed to load matcher config', // eslint-disable-line max-len
169169
);
170170
});
171+
172+
it('should load config successfully from multiple paths', async () => {
173+
process.env.PARAMETER_RUNNER_MATCHER_CONFIG_PATH = '/path/to/matcher/config-1:/path/to/matcher/config-2';
174+
process.env.PARAMETER_GITHUB_APP_WEBHOOK_SECRET = '/path/to/webhook/secret';
175+
176+
const partialMatcher1 =
177+
'[{"id":"1","arn":"arn:aws:sqs:queue1","matcherConfig":{"labelMatchers":[["a"]],"exactMatch":true}}';
178+
const partialMatcher2 =
179+
',{"id":"2","arn":"arn:aws:sqs:queue2","matcherConfig":{"labelMatchers":[["b"]],"exactMatch":true}}]';
180+
181+
const combinedMatcherConfig = [
182+
{ id: '1', arn: 'arn:aws:sqs:queue1', matcherConfig: { labelMatchers: [['a']], exactMatch: true } },
183+
{ id: '2', arn: 'arn:aws:sqs:queue2', matcherConfig: { labelMatchers: [['b']], exactMatch: true } },
184+
];
185+
186+
vi.mocked(getParameter).mockImplementation(async (paramPath: string) => {
187+
if (paramPath === '/path/to/matcher/config-1') return partialMatcher1;
188+
if (paramPath === '/path/to/matcher/config-2') return partialMatcher2;
189+
if (paramPath === '/path/to/webhook/secret') return 'secret';
190+
return '';
191+
});
192+
193+
const config: ConfigWebhook = await ConfigWebhook.load();
194+
195+
expect(config.matcherConfig).toEqual(combinedMatcherConfig);
196+
expect(config.webhookSecret).toBe('secret');
197+
});
198+
199+
it('should throw error if config loading fails from multiple paths', async () => {
200+
process.env.PARAMETER_RUNNER_MATCHER_CONFIG_PATH = '/path/to/matcher/config-1:/path/to/matcher/config-2';
201+
process.env.PARAMETER_GITHUB_APP_WEBHOOK_SECRET = '/path/to/webhook/secret';
202+
203+
const partialMatcher1 =
204+
'[{"id":"1","arn":"arn:aws:sqs:queue1","matcherConfig":{"labelMatchers":[["a"]],"exactMatch":true}}';
205+
const partialMatcher2 =
206+
',{"id":"2","arn":"arn:aws:sqs:queue2","matcherConfig":{"labelMatchers":[["b"]],"exactMatch":true}}';
207+
208+
vi.mocked(getParameter).mockImplementation(async (paramPath: string) => {
209+
if (paramPath === '/path/to/matcher/config-1') return partialMatcher1;
210+
if (paramPath === '/path/to/matcher/config-2') return partialMatcher2;
211+
if (paramPath === '/path/to/webhook/secret') return 'secret';
212+
return '';
213+
});
214+
215+
await expect(ConfigWebhook.load()).rejects.toThrow(
216+
"Failed to load config: Failed to parse combined matcher config: Expected ',' or ']' after array element in JSON at position 196", // eslint-disable-line max-len
217+
);
218+
});
171219
});
172220

173221
describe('ConfigWebhookEventBridge', () => {
@@ -229,6 +277,32 @@ describe('ConfigLoader Tests', () => {
229277
expect(config.matcherConfig).toEqual(matcherConfig);
230278
});
231279

280+
it('should load config successfully from multiple paths with repo allow list', async () => {
281+
process.env.REPOSITORY_ALLOW_LIST = '["repo1", "repo2"]';
282+
process.env.PARAMETER_RUNNER_MATCHER_CONFIG_PATH = '/path/to/matcher/config-1:/path/to/matcher/config-2';
283+
284+
const partial1 =
285+
'[{"id":"1","arn":"arn:aws:sqs:queue1","matcherConfig":{"labelMatchers":[["x"]],"exactMatch":true}}';
286+
const partial2 =
287+
',{"id":"2","arn":"arn:aws:sqs:queue2","matcherConfig":{"labelMatchers":[["y"]],"exactMatch":true}}]';
288+
289+
const combined: RunnerMatcherConfig[] = [
290+
{ id: '1', arn: 'arn:aws:sqs:queue1', matcherConfig: { labelMatchers: [['x']], exactMatch: true } },
291+
{ id: '2', arn: 'arn:aws:sqs:queue2', matcherConfig: { labelMatchers: [['y']], exactMatch: true } },
292+
];
293+
294+
vi.mocked(getParameter).mockImplementation(async (paramPath: string) => {
295+
if (paramPath === '/path/to/matcher/config-1') return partial1;
296+
if (paramPath === '/path/to/matcher/config-2') return partial2;
297+
return '';
298+
});
299+
300+
const config: ConfigDispatcher = await ConfigDispatcher.load();
301+
302+
expect(config.repositoryAllowList).toEqual(['repo1', 'repo2']);
303+
expect(config.matcherConfig).toEqual(combined);
304+
});
305+
232306
it('should throw error if config loading fails', async () => {
233307
vi.mocked(getParameter).mockImplementation(async (paramPath: string) => {
234308
throw new Error(`Parameter ${paramPath} not found`);
@@ -276,7 +350,7 @@ describe('ConfigLoader Tests', () => {
276350
return '';
277351
});
278352

279-
await expect(ConfigDispatcher.load()).rejects.toThrow('ailed to load config: Matcher config is empty');
353+
await expect(ConfigDispatcher.load()).rejects.toThrow('Failed to load config: Matcher config is empty');
280354
});
281355
});
282356
});

lambdas/functions/webhook/src/ConfigLoader.ts

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,17 +87,44 @@ abstract class BaseConfig {
8787
}
8888
}
8989

90-
export class ConfigWebhook extends BaseConfig {
91-
repositoryAllowList: string[] = [];
90+
abstract class MatcherAwareConfig extends BaseConfig {
9291
matcherConfig: RunnerMatcherConfig[] = [];
92+
93+
protected async loadMatcherConfig(paramPathsEnv: string) {
94+
if (!paramPathsEnv || paramPathsEnv === 'undefined' || paramPathsEnv === 'null' || !paramPathsEnv.includes(':')) {
95+
// Single path or invalid string → load directly
96+
await this.loadParameter(paramPathsEnv, 'matcherConfig');
97+
return;
98+
}
99+
100+
const paths = paramPathsEnv
101+
.split(':')
102+
.map((p) => p.trim())
103+
.filter(Boolean);
104+
let combinedString = '';
105+
for (const path of paths) {
106+
await this.loadParameter(path, 'matcherConfig');
107+
combinedString += this.matcherConfig;
108+
}
109+
110+
try {
111+
this.matcherConfig = JSON.parse(combinedString);
112+
} catch (error) {
113+
this.configLoadingErrors.push(`Failed to parse combined matcher config: ${(error as Error).message}`);
114+
}
115+
}
116+
}
117+
118+
export class ConfigWebhook extends MatcherAwareConfig {
119+
repositoryAllowList: string[] = [];
93120
webhookSecret: string = '';
94121
workflowJobEventSecondaryQueue: string = '';
95122

96123
async loadConfig(): Promise<void> {
97124
this.loadEnvVar(process.env.REPOSITORY_ALLOW_LIST, 'repositoryAllowList', []);
98125

99126
await Promise.all([
100-
this.loadParameter(process.env.PARAMETER_RUNNER_MATCHER_CONFIG_PATH, 'matcherConfig'),
127+
this.loadMatcherConfig(process.env.PARAMETER_RUNNER_MATCHER_CONFIG_PATH),
101128
this.loadParameter(process.env.PARAMETER_GITHUB_APP_WEBHOOK_SECRET, 'webhookSecret'),
102129
]);
103130

@@ -121,14 +148,13 @@ export class ConfigWebhookEventBridge extends BaseConfig {
121148
}
122149
}
123150

124-
export class ConfigDispatcher extends BaseConfig {
151+
export class ConfigDispatcher extends MatcherAwareConfig {
125152
repositoryAllowList: string[] = [];
126-
matcherConfig: RunnerMatcherConfig[] = [];
127153
workflowJobEventSecondaryQueue: string = ''; // Deprecated
128154

129155
async loadConfig(): Promise<void> {
130156
this.loadEnvVar(process.env.REPOSITORY_ALLOW_LIST, 'repositoryAllowList', []);
131-
await this.loadParameter(process.env.PARAMETER_RUNNER_MATCHER_CONFIG_PATH, 'matcherConfig');
157+
await this.loadMatcherConfig(process.env.PARAMETER_RUNNER_MATCHER_CONFIG_PATH);
132158

133159
validateRunnerMatcherConfig(this);
134160
}

lambdas/libs/aws-powertools-util/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
},
1717
"devDependencies": {
1818
"@types/aws-lambda": "^8.10.155",
19-
"@types/node": "^22.18.8",
19+
"@types/node": "^22.19.0",
2020
"body-parser": "^2.2.0"
2121
},
2222
"dependencies": {

lambdas/libs/aws-ssm-util/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"devDependencies": {
1818
"@aws-sdk/types": "^3.921.0",
1919
"@types/aws-lambda": "^8.10.155",
20-
"@types/node": "^22.18.8",
20+
"@types/node": "^22.19.0",
2121
"aws-sdk-client-mock": "^4.1.0",
2222
"aws-sdk-client-mock-jest": "^4.1.0"
2323
},

lambdas/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@
2929
"@nx/js": "^22.0.2",
3030
"@nx/vite": "^22.0.2",
3131
"@swc-node/register": "~1.11.1",
32-
"@swc/core": "~1.13.20",
32+
"@swc/core": "~1.15.0",
3333
"@swc/helpers": "~0.5.17",
3434
"@trivago/prettier-plugin-sort-imports": "^5.2.2",
3535
"@typescript-eslint/eslint-plugin": "^8.46.0",
3636
"@typescript-eslint/parser": "^8.46.2",
3737
"@vitest/coverage-v8": "^4.0.5",
3838
"chalk": "^5.6.2",
39-
"eslint": "^9.38.0",
39+
"eslint": "^9.39.1",
4040
"eslint-plugin-prettier": "5.5.4",
4141
"nx": "21.6.5",
4242
"prettier": "^3.6.2",

0 commit comments

Comments
 (0)