mirror of
https://github.com/github/codeql-action.git
synced 2025-12-06 07:48:17 +08:00
Rename getMemoryFlagValue
This commit is contained in:
4
lib/analyze-action.js
generated
4
lib/analyze-action.js
generated
@@ -87093,7 +87093,7 @@ function getCgroupMemoryLimitBytes(limitFile, logger) {
|
||||
);
|
||||
return limit;
|
||||
}
|
||||
function getMemoryFlagValue(userInput, logger) {
|
||||
function getCodeQLMemoryLimit(userInput, logger) {
|
||||
return getMemoryFlagValueForPlatform(
|
||||
userInput,
|
||||
getTotalMemoryBytes(logger),
|
||||
@@ -87101,7 +87101,7 @@ function getMemoryFlagValue(userInput, logger) {
|
||||
);
|
||||
}
|
||||
function getMemoryFlag(userInput, logger) {
|
||||
const megabytes = getMemoryFlagValue(userInput, logger);
|
||||
const megabytes = getCodeQLMemoryLimit(userInput, logger);
|
||||
return `--ram=${megabytes}`;
|
||||
}
|
||||
function getThreadsFlagValue(userInput, logger) {
|
||||
|
||||
6
lib/init-action.js
generated
6
lib/init-action.js
generated
@@ -84396,7 +84396,7 @@ function getCgroupMemoryLimitBytes(limitFile, logger) {
|
||||
);
|
||||
return limit;
|
||||
}
|
||||
function getMemoryFlagValue(userInput, logger) {
|
||||
function getCodeQLMemoryLimit(userInput, logger) {
|
||||
return getMemoryFlagValueForPlatform(
|
||||
userInput,
|
||||
getTotalMemoryBytes(logger),
|
||||
@@ -86935,7 +86935,7 @@ async function runnerSupportsOverlayAnalysis(ramInput, logger) {
|
||||
);
|
||||
return false;
|
||||
}
|
||||
const memoryFlagValue = getMemoryFlagValue(ramInput, logger);
|
||||
const memoryFlagValue = getCodeQLMemoryLimit(ramInput, logger);
|
||||
if (memoryFlagValue < OVERLAY_MINIMUM_MEMORY_MB) {
|
||||
logger.info(
|
||||
`Setting overlay database mode to ${"none" /* None */} due to insufficient memory for CodeQL analysis (${memoryFlagValue} MB).`
|
||||
@@ -90176,7 +90176,7 @@ exec ${goBinaryPath} "$@"`
|
||||
}
|
||||
core13.exportVariable(
|
||||
"CODEQL_RAM",
|
||||
process.env["CODEQL_RAM"] || getMemoryFlagValue(getOptionalInput("ram"), logger).toString()
|
||||
process.env["CODEQL_RAM"] || getCodeQLMemoryLimit(getOptionalInput("ram"), logger).toString()
|
||||
);
|
||||
core13.exportVariable(
|
||||
"CODEQL_THREADS",
|
||||
|
||||
@@ -1040,7 +1040,7 @@ const getOverlayDatabaseModeMacro = test.macro({
|
||||
.stub(actionsUtil, "isAnalyzingPullRequest")
|
||||
.returns(setup.isPullRequest);
|
||||
|
||||
sinon.stub(util, "getMemoryFlagValue").returns(setup.memoryFlagValue);
|
||||
sinon.stub(util, "getCodeQLMemoryLimit").returns(setup.memoryFlagValue);
|
||||
|
||||
// Set up CodeQL mock
|
||||
const codeql = mockCodeQLVersion(setup.codeqlVersion);
|
||||
|
||||
@@ -44,7 +44,7 @@ import {
|
||||
cloneObject,
|
||||
isDefined,
|
||||
checkDiskUsage,
|
||||
getMemoryFlagValue,
|
||||
getCodeQLMemoryLimit,
|
||||
} from "./util";
|
||||
|
||||
export * from "./config/db-config";
|
||||
@@ -664,7 +664,7 @@ async function runnerSupportsOverlayAnalysis(
|
||||
return false;
|
||||
}
|
||||
|
||||
const memoryFlagValue = getMemoryFlagValue(ramInput, logger);
|
||||
const memoryFlagValue = getCodeQLMemoryLimit(ramInput, logger);
|
||||
if (memoryFlagValue < OVERLAY_MINIMUM_MEMORY_MB) {
|
||||
logger.info(
|
||||
`Setting overlay database mode to ${OverlayDatabaseMode.None} ` +
|
||||
|
||||
@@ -75,7 +75,7 @@ import {
|
||||
codeQlVersionAtLeast,
|
||||
DEFAULT_DEBUG_ARTIFACT_NAME,
|
||||
DEFAULT_DEBUG_DATABASE_NAME,
|
||||
getMemoryFlagValue,
|
||||
getCodeQLMemoryLimit,
|
||||
getRequiredEnvParam,
|
||||
getThreadsFlagValue,
|
||||
initializeEnvironment,
|
||||
@@ -538,7 +538,7 @@ async function run() {
|
||||
core.exportVariable(
|
||||
"CODEQL_RAM",
|
||||
process.env["CODEQL_RAM"] ||
|
||||
getMemoryFlagValue(getOptionalInput("ram"), logger).toString(),
|
||||
getCodeQLMemoryLimit(getOptionalInput("ram"), logger).toString(),
|
||||
);
|
||||
core.exportVariable(
|
||||
"CODEQL_THREADS",
|
||||
|
||||
10
src/util.ts
10
src/util.ts
@@ -309,13 +309,13 @@ function getCgroupMemoryLimitBytes(
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of the codeql `--ram` flag as configured by the `ram` input.
|
||||
* If no value was specified, the total available memory will be used minus a
|
||||
* Get the maximum amount of memory CodeQL is allowed to use. If no limit has been
|
||||
* configured by the user, then the total available memory will be used minus a
|
||||
* threshold reserved for the OS.
|
||||
*
|
||||
* @returns {number} the amount of RAM to use, in megabytes
|
||||
* @returns {number} the amount of RAM CodeQL is allowed to use, in megabytes
|
||||
*/
|
||||
export function getMemoryFlagValue(
|
||||
export function getCodeQLMemoryLimit(
|
||||
userInput: string | undefined,
|
||||
logger: Logger,
|
||||
): number {
|
||||
@@ -337,7 +337,7 @@ export function getMemoryFlag(
|
||||
userInput: string | undefined,
|
||||
logger: Logger,
|
||||
): string {
|
||||
const megabytes = getMemoryFlagValue(userInput, logger);
|
||||
const megabytes = getCodeQLMemoryLimit(userInput, logger);
|
||||
return `--ram=${megabytes}`;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user