mirror of
https://github.com/github/codeql-action.git
synced 2026-05-30 02:14:32 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3dc99aad86 |
Generated
+3
-22
@@ -149475,11 +149475,6 @@ var featureConfig = {
|
|||||||
minimumVersion: void 0,
|
minimumVersion: void 0,
|
||||||
toolsFeature: "suppressesMissingFileBaselineWarning" /* SuppressesMissingFileBaselineWarning */
|
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 */]: {
|
["start_proxy_use_features_release" /* StartProxyUseFeaturesRelease */]: {
|
||||||
defaultValue: false,
|
defaultValue: false,
|
||||||
envVar: "CODEQL_ACTION_START_PROXY_USE_FEATURES_RELEASE",
|
envVar: "CODEQL_ACTION_START_PROXY_USE_FEATURES_RELEASE",
|
||||||
@@ -160351,15 +160346,6 @@ function isPAT(value) {
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
var LANGUAGE_TO_REGISTRY_TYPE = {
|
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: [],
|
actions: [],
|
||||||
cpp: [],
|
cpp: [],
|
||||||
java: ["maven_repository"],
|
java: ["maven_repository"],
|
||||||
@@ -160388,9 +160374,8 @@ function getRegistryAddress(registry) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function getCredentials(logger, registrySecrets, registriesCredentials, language, skipUnusedRegistries = false) {
|
function getCredentials(logger, registrySecrets, registriesCredentials, language) {
|
||||||
const registryMapping = skipUnusedRegistries ? NEW_LANGUAGE_TO_REGISTRY_TYPE : LANGUAGE_TO_REGISTRY_TYPE;
|
const registryTypeForLanguage = language ? LANGUAGE_TO_REGISTRY_TYPE[language] : void 0;
|
||||||
const registryTypeForLanguage = language ? registryMapping[language] : void 0;
|
|
||||||
let credentialsStr;
|
let credentialsStr;
|
||||||
if (registriesCredentials !== void 0) {
|
if (registriesCredentials !== void 0) {
|
||||||
logger.info(`Using registries_credentials input.`);
|
logger.info(`Using registries_credentials input.`);
|
||||||
@@ -160914,15 +160899,11 @@ async function run7(startedAt) {
|
|||||||
);
|
);
|
||||||
const languageInput = getOptionalInput("language");
|
const languageInput = getOptionalInput("language");
|
||||||
language = languageInput ? parseBuiltInLanguage(languageInput) : void 0;
|
language = languageInput ? parseBuiltInLanguage(languageInput) : void 0;
|
||||||
const skipUnusedRegistries = await features.getValue(
|
|
||||||
"start_proxy_remove_unused_registries" /* StartProxyRemoveUnusedRegistries */
|
|
||||||
);
|
|
||||||
const credentials = getCredentials(
|
const credentials = getCredentials(
|
||||||
logger,
|
logger,
|
||||||
getOptionalInput("registry_secrets"),
|
getOptionalInput("registry_secrets"),
|
||||||
getOptionalInput("registries_credentials"),
|
getOptionalInput("registries_credentials"),
|
||||||
language,
|
language
|
||||||
skipUnusedRegistries
|
|
||||||
);
|
);
|
||||||
if (credentials.length === 0) {
|
if (credentials.length === 0) {
|
||||||
logger.info("No credentials found, skipping proxy setup.");
|
logger.info("No credentials found, skipping proxy setup.");
|
||||||
|
|||||||
Generated
-5
@@ -89498,11 +89498,6 @@ var featureConfig = {
|
|||||||
minimumVersion: void 0,
|
minimumVersion: void 0,
|
||||||
toolsFeature: "suppressesMissingFileBaselineWarning" /* SuppressesMissingFileBaselineWarning */
|
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 */]: {
|
["start_proxy_use_features_release" /* StartProxyUseFeaturesRelease */]: {
|
||||||
defaultValue: false,
|
defaultValue: false,
|
||||||
envVar: "CODEQL_ACTION_START_PROXY_USE_FEATURES_RELEASE",
|
envVar: "CODEQL_ACTION_START_PROXY_USE_FEATURES_RELEASE",
|
||||||
|
|||||||
@@ -129,7 +129,6 @@ export enum Feature {
|
|||||||
QaTelemetryEnabled = "qa_telemetry_enabled",
|
QaTelemetryEnabled = "qa_telemetry_enabled",
|
||||||
/** Note that this currently only disables baseline file coverage information. */
|
/** Note that this currently only disables baseline file coverage information. */
|
||||||
SkipFileCoverageOnPrs = "skip_file_coverage_on_prs",
|
SkipFileCoverageOnPrs = "skip_file_coverage_on_prs",
|
||||||
StartProxyRemoveUnusedRegistries = "start_proxy_remove_unused_registries",
|
|
||||||
StartProxyUseFeaturesRelease = "start_proxy_use_features_release",
|
StartProxyUseFeaturesRelease = "start_proxy_use_features_release",
|
||||||
UploadOverlayDbToApi = "upload_overlay_db_to_api",
|
UploadOverlayDbToApi = "upload_overlay_db_to_api",
|
||||||
ValidateDbConfig = "validate_db_config",
|
ValidateDbConfig = "validate_db_config",
|
||||||
@@ -365,11 +364,6 @@ export const featureConfig = {
|
|||||||
minimumVersion: undefined,
|
minimumVersion: undefined,
|
||||||
toolsFeature: ToolsFeature.SuppressesMissingFileBaselineWarning,
|
toolsFeature: ToolsFeature.SuppressesMissingFileBaselineWarning,
|
||||||
},
|
},
|
||||||
[Feature.StartProxyRemoveUnusedRegistries]: {
|
|
||||||
defaultValue: false,
|
|
||||||
envVar: "CODEQL_ACTION_START_PROXY_REMOVE_UNUSED_REGISTRIES",
|
|
||||||
minimumVersion: undefined,
|
|
||||||
},
|
|
||||||
[Feature.StartProxyUseFeaturesRelease]: {
|
[Feature.StartProxyUseFeaturesRelease]: {
|
||||||
defaultValue: false,
|
defaultValue: false,
|
||||||
envVar: "CODEQL_ACTION_START_PROXY_USE_FEATURES_RELEASE",
|
envVar: "CODEQL_ACTION_START_PROXY_USE_FEATURES_RELEASE",
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import * as core from "@actions/core";
|
|||||||
|
|
||||||
import * as actionsUtil from "./actions-util";
|
import * as actionsUtil from "./actions-util";
|
||||||
import { getGitHubVersion } from "./api-client";
|
import { getGitHubVersion } from "./api-client";
|
||||||
import { Feature, FeatureEnablement, initFeatures } from "./feature-flags";
|
import { FeatureEnablement, initFeatures } from "./feature-flags";
|
||||||
import { BuiltInLanguage, parseBuiltInLanguage } from "./languages";
|
import { BuiltInLanguage, parseBuiltInLanguage } from "./languages";
|
||||||
import { getActionsLogger, Logger } from "./logging";
|
import { getActionsLogger, Logger } from "./logging";
|
||||||
import { getRepositoryNwo } from "./repository";
|
import { getRepositoryNwo } from "./repository";
|
||||||
@@ -57,18 +57,12 @@ async function run(startedAt: Date) {
|
|||||||
const languageInput = actionsUtil.getOptionalInput("language");
|
const languageInput = actionsUtil.getOptionalInput("language");
|
||||||
language = languageInput ? parseBuiltInLanguage(languageInput) : undefined;
|
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.
|
// Get the registry configurations from one of the inputs.
|
||||||
const credentials = getCredentials(
|
const credentials = getCredentials(
|
||||||
logger,
|
logger,
|
||||||
actionsUtil.getOptionalInput("registry_secrets"),
|
actionsUtil.getOptionalInput("registry_secrets"),
|
||||||
actionsUtil.getOptionalInput("registries_credentials"),
|
actionsUtil.getOptionalInput("registries_credentials"),
|
||||||
language,
|
language,
|
||||||
skipUnusedRegistries,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if (credentials.length === 0) {
|
if (credentials.length === 0) {
|
||||||
|
|||||||
+4
-22
@@ -585,7 +585,6 @@ test("getCredentials validates 'replaces-base' correctly", async (t) => {
|
|||||||
undefined,
|
undefined,
|
||||||
credentialsInput,
|
credentialsInput,
|
||||||
BuiltInLanguage.java,
|
BuiltInLanguage.java,
|
||||||
false,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
t.is(credentials.length, 3);
|
t.is(credentials.length, 3);
|
||||||
@@ -604,8 +603,7 @@ test("getCredentials validates 'replaces-base' correctly", async (t) => {
|
|||||||
getRunnerLogger(true),
|
getRunnerLogger(true),
|
||||||
undefined,
|
undefined,
|
||||||
toEncodedJSON([{ ...baseInvalid, "replaces-base": null }]),
|
toEncodedJSON([{ ...baseInvalid, "replaces-base": null }]),
|
||||||
BuiltInLanguage.actions,
|
BuiltInLanguage.java,
|
||||||
false,
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
t.throws(() =>
|
t.throws(() =>
|
||||||
@@ -613,8 +611,7 @@ test("getCredentials validates 'replaces-base' correctly", async (t) => {
|
|||||||
getRunnerLogger(true),
|
getRunnerLogger(true),
|
||||||
undefined,
|
undefined,
|
||||||
toEncodedJSON([{ ...baseInvalid, "replaces-base": 123 }]),
|
toEncodedJSON([{ ...baseInvalid, "replaces-base": 123 }]),
|
||||||
BuiltInLanguage.actions,
|
BuiltInLanguage.java,
|
||||||
false,
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
t.throws(() =>
|
t.throws(() =>
|
||||||
@@ -622,13 +619,12 @@ test("getCredentials validates 'replaces-base' correctly", async (t) => {
|
|||||||
getRunnerLogger(true),
|
getRunnerLogger(true),
|
||||||
undefined,
|
undefined,
|
||||||
toEncodedJSON([{ ...baseInvalid, "replaces-base": "true" }]),
|
toEncodedJSON([{ ...baseInvalid, "replaces-base": "true" }]),
|
||||||
BuiltInLanguage.actions,
|
BuiltInLanguage.java,
|
||||||
false,
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
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 credentialsInput = toEncodedJSON(mixedCredentials);
|
||||||
|
|
||||||
const credentials = startProxyExports.getCredentials(
|
const credentials = startProxyExports.getCredentials(
|
||||||
@@ -636,20 +632,6 @@ test("getCredentials returns all credentials for Actions when using LANGUAGE_TO_
|
|||||||
undefined,
|
undefined,
|
||||||
credentialsInput,
|
credentialsInput,
|
||||||
BuiltInLanguage.actions,
|
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, []);
|
t.deepEqual(credentials, []);
|
||||||
});
|
});
|
||||||
|
|||||||
+2
-16
@@ -189,17 +189,7 @@ function isPAT(value: string) {
|
|||||||
|
|
||||||
type RegistryMapping = Partial<Record<BuiltInLanguage, string[]>>;
|
type RegistryMapping = Partial<Record<BuiltInLanguage, string[]>>;
|
||||||
|
|
||||||
const LANGUAGE_TO_REGISTRY_TYPE: RegistryMapping = {
|
const LANGUAGE_TO_REGISTRY_TYPE: Required<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<RegistryMapping> = {
|
|
||||||
actions: [],
|
actions: [],
|
||||||
cpp: [],
|
cpp: [],
|
||||||
java: ["maven_repository"],
|
java: ["maven_repository"],
|
||||||
@@ -251,13 +241,9 @@ export function getCredentials(
|
|||||||
registrySecrets: string | undefined,
|
registrySecrets: string | undefined,
|
||||||
registriesCredentials: string | undefined,
|
registriesCredentials: string | undefined,
|
||||||
language: BuiltInLanguage | undefined,
|
language: BuiltInLanguage | undefined,
|
||||||
skipUnusedRegistries: boolean = false,
|
|
||||||
): Credential[] {
|
): Credential[] {
|
||||||
const registryMapping = skipUnusedRegistries
|
|
||||||
? NEW_LANGUAGE_TO_REGISTRY_TYPE
|
|
||||||
: LANGUAGE_TO_REGISTRY_TYPE;
|
|
||||||
const registryTypeForLanguage = language
|
const registryTypeForLanguage = language
|
||||||
? registryMapping[language]
|
? LANGUAGE_TO_REGISTRY_TYPE[language]
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|
||||||
let credentialsStr: string;
|
let credentialsStr: string;
|
||||||
|
|||||||
Reference in New Issue
Block a user