From 3dc99aad864048ca17a43ed225d74a4898ed858a Mon Sep 17 00:00:00 2001 From: "Michael B. Gale" Date: Mon, 18 May 2026 16:17:15 +0100 Subject: [PATCH] Default to `StartProxyRemoveUnusedRegistries` behaviour --- lib/entry-points.js | 25 +++---------------------- lib/upload-lib.js | 5 ----- src/feature-flags.ts | 6 ------ src/start-proxy-action.ts | 8 +------- src/start-proxy.test.ts | 26 ++++---------------------- src/start-proxy.ts | 18 ++---------------- 6 files changed, 10 insertions(+), 78 deletions(-) diff --git a/lib/entry-points.js b/lib/entry-points.js index 079b8eee5a..8d14547199 100644 --- a/lib/entry-points.js +++ b/lib/entry-points.js @@ -149475,11 +149475,6 @@ var featureConfig = { minimumVersion: void 0, toolsFeature: "suppressesMissingFileBaselineWarning" /* SuppressesMissingFileBaselineWarning */ }, - ["start_proxy_remove_unused_registries" /* StartProxyRemoveUnusedRegistries */]: { - defaultValue: false, - envVar: "CODEQL_ACTION_START_PROXY_REMOVE_UNUSED_REGISTRIES", - minimumVersion: void 0 - }, ["start_proxy_use_features_release" /* StartProxyUseFeaturesRelease */]: { defaultValue: false, envVar: "CODEQL_ACTION_START_PROXY_USE_FEATURES_RELEASE", @@ -160351,15 +160346,6 @@ function isPAT(value) { ]); } var LANGUAGE_TO_REGISTRY_TYPE = { - java: ["maven_repository"], - csharp: ["nuget_feed"], - javascript: ["npm_registry"], - python: ["python_index"], - ruby: ["rubygems_server"], - rust: ["cargo_registry"], - go: ["goproxy_server", "git_source"] -}; -var NEW_LANGUAGE_TO_REGISTRY_TYPE = { actions: [], cpp: [], java: ["maven_repository"], @@ -160388,9 +160374,8 @@ function getRegistryAddress(registry) { ); } } -function getCredentials(logger, registrySecrets, registriesCredentials, language, skipUnusedRegistries = false) { - const registryMapping = skipUnusedRegistries ? NEW_LANGUAGE_TO_REGISTRY_TYPE : LANGUAGE_TO_REGISTRY_TYPE; - const registryTypeForLanguage = language ? registryMapping[language] : void 0; +function getCredentials(logger, registrySecrets, registriesCredentials, language) { + const registryTypeForLanguage = language ? LANGUAGE_TO_REGISTRY_TYPE[language] : void 0; let credentialsStr; if (registriesCredentials !== void 0) { logger.info(`Using registries_credentials input.`); @@ -160914,15 +160899,11 @@ async function run7(startedAt) { ); const languageInput = getOptionalInput("language"); language = languageInput ? parseBuiltInLanguage(languageInput) : void 0; - const skipUnusedRegistries = await features.getValue( - "start_proxy_remove_unused_registries" /* StartProxyRemoveUnusedRegistries */ - ); const credentials = getCredentials( logger, getOptionalInput("registry_secrets"), getOptionalInput("registries_credentials"), - language, - skipUnusedRegistries + language ); if (credentials.length === 0) { logger.info("No credentials found, skipping proxy setup."); diff --git a/lib/upload-lib.js b/lib/upload-lib.js index d355fedf43..c32e49e424 100644 --- a/lib/upload-lib.js +++ b/lib/upload-lib.js @@ -89498,11 +89498,6 @@ var featureConfig = { minimumVersion: void 0, toolsFeature: "suppressesMissingFileBaselineWarning" /* SuppressesMissingFileBaselineWarning */ }, - ["start_proxy_remove_unused_registries" /* StartProxyRemoveUnusedRegistries */]: { - defaultValue: false, - envVar: "CODEQL_ACTION_START_PROXY_REMOVE_UNUSED_REGISTRIES", - minimumVersion: void 0 - }, ["start_proxy_use_features_release" /* StartProxyUseFeaturesRelease */]: { defaultValue: false, envVar: "CODEQL_ACTION_START_PROXY_USE_FEATURES_RELEASE", diff --git a/src/feature-flags.ts b/src/feature-flags.ts index 6b40d04dab..c7cfb7efef 100644 --- a/src/feature-flags.ts +++ b/src/feature-flags.ts @@ -129,7 +129,6 @@ export enum Feature { QaTelemetryEnabled = "qa_telemetry_enabled", /** Note that this currently only disables baseline file coverage information. */ SkipFileCoverageOnPrs = "skip_file_coverage_on_prs", - StartProxyRemoveUnusedRegistries = "start_proxy_remove_unused_registries", StartProxyUseFeaturesRelease = "start_proxy_use_features_release", UploadOverlayDbToApi = "upload_overlay_db_to_api", ValidateDbConfig = "validate_db_config", @@ -365,11 +364,6 @@ export const featureConfig = { minimumVersion: undefined, toolsFeature: ToolsFeature.SuppressesMissingFileBaselineWarning, }, - [Feature.StartProxyRemoveUnusedRegistries]: { - defaultValue: false, - envVar: "CODEQL_ACTION_START_PROXY_REMOVE_UNUSED_REGISTRIES", - minimumVersion: undefined, - }, [Feature.StartProxyUseFeaturesRelease]: { defaultValue: false, envVar: "CODEQL_ACTION_START_PROXY_USE_FEATURES_RELEASE", diff --git a/src/start-proxy-action.ts b/src/start-proxy-action.ts index 609b576441..3e376ec64f 100644 --- a/src/start-proxy-action.ts +++ b/src/start-proxy-action.ts @@ -5,7 +5,7 @@ import * as core from "@actions/core"; import * as actionsUtil from "./actions-util"; import { getGitHubVersion } from "./api-client"; -import { Feature, FeatureEnablement, initFeatures } from "./feature-flags"; +import { FeatureEnablement, initFeatures } from "./feature-flags"; import { BuiltInLanguage, parseBuiltInLanguage } from "./languages"; import { getActionsLogger, Logger } from "./logging"; import { getRepositoryNwo } from "./repository"; @@ -57,18 +57,12 @@ async function run(startedAt: Date) { const languageInput = actionsUtil.getOptionalInput("language"); language = languageInput ? parseBuiltInLanguage(languageInput) : undefined; - // Query the FF for whether we should use the reduced registry mapping. - const skipUnusedRegistries = await features.getValue( - Feature.StartProxyRemoveUnusedRegistries, - ); - // Get the registry configurations from one of the inputs. const credentials = getCredentials( logger, actionsUtil.getOptionalInput("registry_secrets"), actionsUtil.getOptionalInput("registries_credentials"), language, - skipUnusedRegistries, ); if (credentials.length === 0) { diff --git a/src/start-proxy.test.ts b/src/start-proxy.test.ts index 9f12656f62..6a905f16b7 100644 --- a/src/start-proxy.test.ts +++ b/src/start-proxy.test.ts @@ -585,7 +585,6 @@ test("getCredentials validates 'replaces-base' correctly", async (t) => { undefined, credentialsInput, BuiltInLanguage.java, - false, ); t.is(credentials.length, 3); @@ -604,8 +603,7 @@ test("getCredentials validates 'replaces-base' correctly", async (t) => { getRunnerLogger(true), undefined, toEncodedJSON([{ ...baseInvalid, "replaces-base": null }]), - BuiltInLanguage.actions, - false, + BuiltInLanguage.java, ), ); t.throws(() => @@ -613,8 +611,7 @@ test("getCredentials validates 'replaces-base' correctly", async (t) => { getRunnerLogger(true), undefined, toEncodedJSON([{ ...baseInvalid, "replaces-base": 123 }]), - BuiltInLanguage.actions, - false, + BuiltInLanguage.java, ), ); t.throws(() => @@ -622,13 +619,12 @@ test("getCredentials validates 'replaces-base' correctly", async (t) => { getRunnerLogger(true), undefined, toEncodedJSON([{ ...baseInvalid, "replaces-base": "true" }]), - BuiltInLanguage.actions, - false, + BuiltInLanguage.java, ), ); }); -test("getCredentials returns all credentials for Actions when using LANGUAGE_TO_REGISTRY_TYPE", async (t) => { +test("getCredentials returns no credentials for Actions", async (t) => { const credentialsInput = toEncodedJSON(mixedCredentials); const credentials = startProxyExports.getCredentials( @@ -636,20 +632,6 @@ test("getCredentials returns all credentials for Actions when using LANGUAGE_TO_ undefined, credentialsInput, BuiltInLanguage.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, - BuiltInLanguage.actions, - true, ); t.deepEqual(credentials, []); }); diff --git a/src/start-proxy.ts b/src/start-proxy.ts index d6111510f6..6b956d6473 100644 --- a/src/start-proxy.ts +++ b/src/start-proxy.ts @@ -189,17 +189,7 @@ function isPAT(value: string) { type RegistryMapping = Partial>; -const LANGUAGE_TO_REGISTRY_TYPE: RegistryMapping = { - java: ["maven_repository"], - csharp: ["nuget_feed"], - javascript: ["npm_registry"], - python: ["python_index"], - ruby: ["rubygems_server"], - rust: ["cargo_registry"], - go: ["goproxy_server", "git_source"], -} as const; - -const NEW_LANGUAGE_TO_REGISTRY_TYPE: Required = { +const LANGUAGE_TO_REGISTRY_TYPE: Required = { actions: [], cpp: [], java: ["maven_repository"], @@ -251,13 +241,9 @@ export function getCredentials( registrySecrets: string | undefined, registriesCredentials: string | undefined, language: BuiltInLanguage | undefined, - skipUnusedRegistries: boolean = false, ): Credential[] { - const registryMapping = skipUnusedRegistries - ? NEW_LANGUAGE_TO_REGISTRY_TYPE - : LANGUAGE_TO_REGISTRY_TYPE; const registryTypeForLanguage = language - ? registryMapping[language] + ? LANGUAGE_TO_REGISTRY_TYPE[language] : undefined; let credentialsStr: string;