-
Notifications
You must be signed in to change notification settings - Fork 446
Remove unused registry types from LANGUAGE_TO_REGISTRY_TYPE
#3527
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
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -328,6 +328,32 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| test("getCredentials returns all credentials for Actions when using LANGUAGE_TO_REGISTRY_TYPE", async (t) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const credentialsInput = toEncodedJSON(mixedCredentials); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const credentials = startProxyExports.getCredentials( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| getRunnerLogger(true), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| undefined, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| credentialsInput, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| KnownLanguage.actions, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| false, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| t.is(credentials.length, mixedCredentials.length); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| test("getCredentials returns no credentials for Actions when using NEW_LANGUAGE_TO_REGISTRY_TYPE", async (t) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const credentialsInput = toEncodedJSON(mixedCredentials); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const credentials = startProxyExports.getCredentials( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| getRunnerLogger(true), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| undefined, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| credentialsInput, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| KnownLanguage.actions, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| true, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| t.deepEqual(credentials, []); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| test("getCredentials returns all credentials for Cpp when using LANGUAGE_TO_REGISTRY_TYPE", async (t) => { | |
| const credentialsInput = toEncodedJSON(mixedCredentials); | |
| const credentials = startProxyExports.getCredentials( | |
| getRunnerLogger(true), | |
| undefined, | |
| credentialsInput, | |
| KnownLanguage.cpp, | |
| false, | |
| ); | |
| t.is(credentials.length, mixedCredentials.length); | |
| }); | |
| test("getCredentials returns no credentials for Cpp when using NEW_LANGUAGE_TO_REGISTRY_TYPE", async (t) => { | |
| const credentialsInput = toEncodedJSON(mixedCredentials); | |
| const credentials = startProxyExports.getCredentials( | |
| getRunnerLogger(true), | |
| undefined, | |
| credentialsInput, | |
| KnownLanguage.cpp, | |
| true, | |
| ); | |
| t.deepEqual(credentials, []); | |
| }); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -224,7 +224,9 @@ function isPAT(value: string) { | |
| ]); | ||
| } | ||
|
|
||
| const LANGUAGE_TO_REGISTRY_TYPE: Partial<Record<KnownLanguage, string[]>> = { | ||
| type RegistryMapping = Partial<Record<KnownLanguage, string[]>>; | ||
|
|
||
| const LANGUAGE_TO_REGISTRY_TYPE: RegistryMapping = { | ||
| java: ["maven_repository"], | ||
| csharp: ["nuget_feed"], | ||
| javascript: ["npm_registry"], | ||
|
|
@@ -234,6 +236,17 @@ const LANGUAGE_TO_REGISTRY_TYPE: Partial<Record<KnownLanguage, string[]>> = { | |
| go: ["goproxy_server", "git_source"], | ||
| } as const; | ||
|
|
||
| const NEW_LANGUAGE_TO_REGISTRY_TYPE: RegistryMapping = { | ||
| actions: [], | ||
| java: ["maven_repository"], | ||
| csharp: ["nuget_feed"], | ||
| javascript: [], | ||
| python: [], | ||
| ruby: [], | ||
| rust: [], | ||
| go: ["goproxy_server", "git_source"], | ||
| } as const; | ||
|
Comment on lines
+239
to
+248
|
||
|
|
||
| /** | ||
| * Extracts an `Address` value from the given `Registry` value by determining whether it has | ||
| * a `url` value, or no `url` value but a `host` value. | ||
|
|
@@ -267,9 +280,13 @@ export function getCredentials( | |
| registrySecrets: string | undefined, | ||
| registriesCredentials: string | undefined, | ||
| language: KnownLanguage | undefined, | ||
| skipUnusedRegistries: boolean = false, | ||
| ): Credential[] { | ||
| const registryMapping = skipUnusedRegistries | ||
| ? NEW_LANGUAGE_TO_REGISTRY_TYPE | ||
| : LANGUAGE_TO_REGISTRY_TYPE; | ||
| const registryTypeForLanguage = language | ||
| ? LANGUAGE_TO_REGISTRY_TYPE[language] | ||
| ? registryMapping[language] | ||
| : undefined; | ||
|
|
||
| let credentialsStr: string; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.