-
Couldn't load subscription status.
- Fork 687
feat: support multiple SSM parameters for large runner matcher configs (#4790) #4792
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
2d5991f
85df592
4af61cf
9c22d0b
214ca91
06c1dcc
2259aaf
40e2a53
bc9eb93
b6e68d7
367d51e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -87,17 +87,44 @@ abstract class BaseConfig { | |||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| export class ConfigWebhook extends BaseConfig { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| repositoryAllowList: string[] = []; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| abstract class MatcherAwareConfig extends BaseConfig { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| matcherConfig: RunnerMatcherConfig[] = []; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| protected async loadMatcherConfig(paramPathsEnv: string) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| if (!paramPathsEnv || paramPathsEnv === 'undefined' || paramPathsEnv === 'null' || !paramPathsEnv.includes(':')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| await this.loadParameter(paramPathsEnv, 'matcherConfig'); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| return; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| const paths = paramPathsEnv | ||||||||||||||||||||||||||||||||||||||||||||||||||
| .split(':') | ||||||||||||||||||||||||||||||||||||||||||||||||||
| .map((p) => p.trim()) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| .filter(Boolean); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| let combinedString = ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| for (const path of paths) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| await this.loadParameter(path, 'matcherConfig'); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| combinedString += this.matcherConfig; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| try { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| this.matcherConfig = JSON.parse(combinedString); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } catch (error) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| this.configLoadingErrors.push(`Failed to parse combined matcher config: ${(error as Error).message}`); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+103
to
+114
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| let combinedString = ''; | |
| for (const path of paths) { | |
| await this.loadParameter(path, 'matcherConfig'); | |
| combinedString += this.matcherConfig; | |
| } | |
| try { | |
| this.matcherConfig = JSON.parse(combinedString); | |
| } catch (error) { | |
| this.configLoadingErrors.push(`Failed to parse combined matcher config: ${(error as Error).message}`); | |
| } | |
| let combinedMatcherConfig: RunnerMatcherConfig[] = []; | |
| for (const path of paths) { | |
| await this.loadParameter(path, 'matcherConfig'); | |
| if (Array.isArray(this.matcherConfig)) { | |
| combinedMatcherConfig.push(...this.matcherConfig); | |
| } else { | |
| this.configLoadingErrors.push(`Matcher config at path "${path}" is not an array`); | |
| } | |
| } | |
| this.matcherConfig = combinedMatcherConfig; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The condition logic is incorrect. When there's no colon in the path (single parameter), the function should still load the parameter, but the condition will return true and call
loadParameterwith the full path. However, when there IS a colon (multiple parameters), the condition returns false and proceeds to the multi-path logic. The condition should be!paramPathsEnv.includes(':')to handle single parameters correctly.