Make getCodeQLForCmd use Env

This commit is contained in:
Michael B. Gale
2026-10-09 15:13:16 +01:00
parent b904de6d18
commit 08bb1f303d
4 changed files with 51 additions and 37 deletions

38
lib/entry-points.js generated
View File

@@ -176950,13 +176950,13 @@ async function getCodeQL(logger2, cmd) {
}
return cachedCodeQL;
}
async function getCodeQLForCmd(logger2, cmd, checkVersion) {
async function getCodeQLForCmd(logger2, cmd, checkVersion, env = getEnv()) {
const codeql = {
getPath() {
return cmd;
},
async getVersion() {
const cacheFilePath = getCommandCacheFilePath(getEnv());
const cacheFilePath = getCommandCacheFilePath(env);
let result = getCachedCodeQlVersion(
logger2,
cacheFilePath,
@@ -177066,14 +177066,17 @@ async function getCodeQLForCmd(logger2, cmd, checkVersion) {
}
},
async runAutobuild(config, language) {
applyAutobuildAzurePipelinesTimeoutFix();
applyAutobuildAzurePipelinesTimeoutFix(env);
const autobuildCmd = path15.join(
await this.resolveExtractor(language),
"tools",
process.platform === "win32" ? "autobuild.cmd" : "autobuild.sh"
);
if (config.debugMode) {
process.env["CODEQL_VERBOSITY" /* CLI_VERBOSITY */] = process.env["CODEQL_VERBOSITY" /* CLI_VERBOSITY */] || EXTRACTION_DEBUG_MODE_VERBOSITY;
env.set(
"CODEQL_VERBOSITY" /* CLI_VERBOSITY */,
env.getOptional("CODEQL_VERBOSITY" /* CLI_VERBOSITY */) ?? EXTRACTION_DEBUG_MODE_VERBOSITY
);
}
await runCli(autobuildCmd);
},
@@ -177090,7 +177093,7 @@ async function getCodeQLForCmd(logger2, cmd, checkVersion) {
},
async extractUsingBuildMode(config, language) {
if (config.buildMode === "autobuild" /* Autobuild */) {
applyAutobuildAzurePipelinesTimeoutFix();
applyAutobuildAzurePipelinesTimeoutFix(env);
}
try {
await runCli(cmd, [
@@ -177192,7 +177195,7 @@ async function getCodeQLForCmd(logger2, cmd, checkVersion) {
"--sarif-group-rules-by-pack",
"--sarif-include-query-help=always",
"--sublanguage-file-coverage",
...await getJobRunUuidSarifOptions(),
...await getJobRunUuidSarifOptions(env),
...getExtraOptionsFromEnv(["database", "interpret-results"])
];
if (sarifRunPropertyFlag !== void 0) {
@@ -177366,7 +177369,7 @@ Output was: ${extractorPath}`
throw new ConfigurationError(
`Expected a CodeQL CLI with version at least ${CODEQL_MINIMUM_VERSION} but got version ${(await codeql.getVersion()).version}`
);
} else if (checkVersion && process.env["CODEQL_ACTION_SUPPRESS_DEPRECATED_SOON_WARNING" /* SUPPRESS_DEPRECATED_SOON_WARNING */] !== "true" && !await codeQlVersionAtLeast(codeql, CODEQL_NEXT_MINIMUM_VERSION)) {
} else if (checkVersion && env.getOptional("CODEQL_ACTION_SUPPRESS_DEPRECATED_SOON_WARNING" /* SUPPRESS_DEPRECATED_SOON_WARNING */) !== "true" && !await codeQlVersionAtLeast(codeql, CODEQL_NEXT_MINIMUM_VERSION)) {
const result = await codeql.getVersion();
core13.warning(
`CodeQL CLI version ${result.version} was discontinued on ${GHES_MOST_RECENT_DEPRECATION_DATE} alongside GitHub Enterprise Server ${GHES_VERSION_MOST_RECENTLY_DEPRECATED} and will not be supported by the next minor release of the CodeQL Action. Please update to CodeQL CLI version ${CODEQL_NEXT_MINIMUM_VERSION} or later. For instance, if you have specified a custom version of the CLI using the 'tools' input to the 'init' Action, you can remove this input to use the default version.
@@ -177473,16 +177476,19 @@ function getGeneratedCodeScanningConfigPath(config) {
function getExtractionVerbosityArguments(enableDebugLogging) {
return enableDebugLogging ? [`--verbosity=${EXTRACTION_DEBUG_MODE_VERBOSITY}`] : [];
}
function applyAutobuildAzurePipelinesTimeoutFix() {
const javaToolOptions = process.env["JAVA_TOOL_OPTIONS"] || "";
process.env["JAVA_TOOL_OPTIONS"] = [
...javaToolOptions.split(/\s+/),
"-Dhttp.keepAlive=false",
"-Dmaven.wagon.http.pool=false"
].join(" ");
function applyAutobuildAzurePipelinesTimeoutFix(env) {
const javaToolOptions = env.getOptional("JAVA_TOOL_OPTIONS") ?? "";
env.set(
"JAVA_TOOL_OPTIONS",
[
...javaToolOptions.split(/\s+/),
"-Dhttp.keepAlive=false",
"-Dmaven.wagon.http.pool=false"
].join(" ")
);
}
async function getJobRunUuidSarifOptions() {
const jobRunUuid = process.env["CODEQL_ACTION_JOB_RUN_UUID" /* JOB_RUN_UUID */];
async function getJobRunUuidSarifOptions(env) {
const jobRunUuid = env.getOptional("CODEQL_ACTION_JOB_RUN_UUID" /* JOB_RUN_UUID */);
return jobRunUuid ? [`--sarif-run-property=jobRunUuid=${jobRunUuid}`] : [];
}