Skip to content

Commit 3dc99aa

Browse files
committed
Default to StartProxyRemoveUnusedRegistries behaviour
1 parent c8a3492 commit 3dc99aa

6 files changed

Lines changed: 10 additions & 78 deletions

File tree

lib/entry-points.js

Lines changed: 3 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/upload-lib.js

Lines changed: 0 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/feature-flags.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ export enum Feature {
129129
QaTelemetryEnabled = "qa_telemetry_enabled",
130130
/** Note that this currently only disables baseline file coverage information. */
131131
SkipFileCoverageOnPrs = "skip_file_coverage_on_prs",
132-
StartProxyRemoveUnusedRegistries = "start_proxy_remove_unused_registries",
133132
StartProxyUseFeaturesRelease = "start_proxy_use_features_release",
134133
UploadOverlayDbToApi = "upload_overlay_db_to_api",
135134
ValidateDbConfig = "validate_db_config",
@@ -365,11 +364,6 @@ export const featureConfig = {
365364
minimumVersion: undefined,
366365
toolsFeature: ToolsFeature.SuppressesMissingFileBaselineWarning,
367366
},
368-
[Feature.StartProxyRemoveUnusedRegistries]: {
369-
defaultValue: false,
370-
envVar: "CODEQL_ACTION_START_PROXY_REMOVE_UNUSED_REGISTRIES",
371-
minimumVersion: undefined,
372-
},
373367
[Feature.StartProxyUseFeaturesRelease]: {
374368
defaultValue: false,
375369
envVar: "CODEQL_ACTION_START_PROXY_USE_FEATURES_RELEASE",

src/start-proxy-action.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import * as core from "@actions/core";
55

66
import * as actionsUtil from "./actions-util";
77
import { getGitHubVersion } from "./api-client";
8-
import { Feature, FeatureEnablement, initFeatures } from "./feature-flags";
8+
import { FeatureEnablement, initFeatures } from "./feature-flags";
99
import { BuiltInLanguage, parseBuiltInLanguage } from "./languages";
1010
import { getActionsLogger, Logger } from "./logging";
1111
import { getRepositoryNwo } from "./repository";
@@ -57,18 +57,12 @@ async function run(startedAt: Date) {
5757
const languageInput = actionsUtil.getOptionalInput("language");
5858
language = languageInput ? parseBuiltInLanguage(languageInput) : undefined;
5959

60-
// Query the FF for whether we should use the reduced registry mapping.
61-
const skipUnusedRegistries = await features.getValue(
62-
Feature.StartProxyRemoveUnusedRegistries,
63-
);
64-
6560
// Get the registry configurations from one of the inputs.
6661
const credentials = getCredentials(
6762
logger,
6863
actionsUtil.getOptionalInput("registry_secrets"),
6964
actionsUtil.getOptionalInput("registries_credentials"),
7065
language,
71-
skipUnusedRegistries,
7266
);
7367

7468
if (credentials.length === 0) {

src/start-proxy.test.ts

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,6 @@ test("getCredentials validates 'replaces-base' correctly", async (t) => {
585585
undefined,
586586
credentialsInput,
587587
BuiltInLanguage.java,
588-
false,
589588
);
590589

591590
t.is(credentials.length, 3);
@@ -604,52 +603,35 @@ test("getCredentials validates 'replaces-base' correctly", async (t) => {
604603
getRunnerLogger(true),
605604
undefined,
606605
toEncodedJSON([{ ...baseInvalid, "replaces-base": null }]),
607-
BuiltInLanguage.actions,
608-
false,
606+
BuiltInLanguage.java,
609607
),
610608
);
611609
t.throws(() =>
612610
startProxyExports.getCredentials(
613611
getRunnerLogger(true),
614612
undefined,
615613
toEncodedJSON([{ ...baseInvalid, "replaces-base": 123 }]),
616-
BuiltInLanguage.actions,
617-
false,
614+
BuiltInLanguage.java,
618615
),
619616
);
620617
t.throws(() =>
621618
startProxyExports.getCredentials(
622619
getRunnerLogger(true),
623620
undefined,
624621
toEncodedJSON([{ ...baseInvalid, "replaces-base": "true" }]),
625-
BuiltInLanguage.actions,
626-
false,
622+
BuiltInLanguage.java,
627623
),
628624
);
629625
});
630626

631-
test("getCredentials returns all credentials for Actions when using LANGUAGE_TO_REGISTRY_TYPE", async (t) => {
627+
test("getCredentials returns no credentials for Actions", async (t) => {
632628
const credentialsInput = toEncodedJSON(mixedCredentials);
633629

634630
const credentials = startProxyExports.getCredentials(
635631
getRunnerLogger(true),
636632
undefined,
637633
credentialsInput,
638634
BuiltInLanguage.actions,
639-
false,
640-
);
641-
t.is(credentials.length, mixedCredentials.length);
642-
});
643-
644-
test("getCredentials returns no credentials for Actions when using NEW_LANGUAGE_TO_REGISTRY_TYPE", async (t) => {
645-
const credentialsInput = toEncodedJSON(mixedCredentials);
646-
647-
const credentials = startProxyExports.getCredentials(
648-
getRunnerLogger(true),
649-
undefined,
650-
credentialsInput,
651-
BuiltInLanguage.actions,
652-
true,
653635
);
654636
t.deepEqual(credentials, []);
655637
});

src/start-proxy.ts

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -189,17 +189,7 @@ function isPAT(value: string) {
189189

190190
type RegistryMapping = Partial<Record<BuiltInLanguage, string[]>>;
191191

192-
const LANGUAGE_TO_REGISTRY_TYPE: RegistryMapping = {
193-
java: ["maven_repository"],
194-
csharp: ["nuget_feed"],
195-
javascript: ["npm_registry"],
196-
python: ["python_index"],
197-
ruby: ["rubygems_server"],
198-
rust: ["cargo_registry"],
199-
go: ["goproxy_server", "git_source"],
200-
} as const;
201-
202-
const NEW_LANGUAGE_TO_REGISTRY_TYPE: Required<RegistryMapping> = {
192+
const LANGUAGE_TO_REGISTRY_TYPE: Required<RegistryMapping> = {
203193
actions: [],
204194
cpp: [],
205195
java: ["maven_repository"],
@@ -251,13 +241,9 @@ export function getCredentials(
251241
registrySecrets: string | undefined,
252242
registriesCredentials: string | undefined,
253243
language: BuiltInLanguage | undefined,
254-
skipUnusedRegistries: boolean = false,
255244
): Credential[] {
256-
const registryMapping = skipUnusedRegistries
257-
? NEW_LANGUAGE_TO_REGISTRY_TYPE
258-
: LANGUAGE_TO_REGISTRY_TYPE;
259245
const registryTypeForLanguage = language
260-
? registryMapping[language]
246+
? LANGUAGE_TO_REGISTRY_TYPE[language]
261247
: undefined;
262248

263249
let credentialsStr: string;

0 commit comments

Comments
 (0)