mirror of
https://github.com/github/codeql-action.git
synced 2026-05-07 22:30:44 +00:00
pass CODEQL_FEATURE_RAM_2023 to the CLI
This prepares for an upcoming change in how the `--ram` argument to the CLI is interpreted. The CLI will interpret _either_ this feature flag _or_ an Action version of 2.22.10 or earlier as a sign that it would fall back to the current interpretation of `--ram`. Later in the future, the Action can start using a less conservative calculation of `--ram` (when it detect the CLI is sufficiently new CLIs) and signal that to the CLI by _not_ passing `CODEQL_FEATURE_RAM_2023` anyway. That way we can avoid wrong RAM settings caused by mismatched CLI and Actions versions.
This commit is contained in:
@@ -29,6 +29,13 @@ export enum EnvVar {
|
||||
/** Whether the CodeQL Action will upload SARIF, not the CLI. */
|
||||
FEATURE_WILL_UPLOAD = "CODEQL_ACTION_FEATURE_WILL_UPLOAD",
|
||||
|
||||
/**
|
||||
* This flag tells `codeql database analyze` that the `--ram` option it gets is still
|
||||
* computed by the 2023 algorithm that leaves space for overshooting.
|
||||
* The CLI will _implicitly_ treat this flag as set if the Action version is 2.22.10 or earlier.
|
||||
*/
|
||||
FEATURE_RAM_2023 = "CODEQL_ACTION_FEATURE_RAM_2023",
|
||||
|
||||
/** Whether the CodeQL Action has already warned the user about low disk space. */
|
||||
HAS_WARNED_ABOUT_DISK_SPACE = "CODEQL_ACTION_HAS_WARNED_ABOUT_DISK_SPACE",
|
||||
|
||||
|
||||
+11
@@ -161,6 +161,16 @@ export async function withTmpDir<T>(
|
||||
* when the user doesn't explicitly specify a memory setting.
|
||||
* This is a heuristic to avoid OOM errors (exit code 137 / SIGKILL)
|
||||
* from committing too much of the available memory to CodeQL.
|
||||
*
|
||||
* BEWARE: Eventually, with new enough CLIs, this computation can be made
|
||||
* less conservative, because the CLI can now itself reserve space for memory
|
||||
* overhead of the JVM. When this happens, stop passing FEATURE_RAM_2023
|
||||
* feature variable.
|
||||
*
|
||||
* Also this rewrite cannot happen until the Action version is strictly above
|
||||
* 2.22.10, because the CLI will interpret a version of 2.22.10 or lower as
|
||||
* "old action that does not yet know to pass FEATURE_RAM_2023".
|
||||
*
|
||||
* @returns number
|
||||
*/
|
||||
function getSystemReservedMemoryMegaBytes(
|
||||
@@ -539,6 +549,7 @@ export function initializeEnvironment(version: string) {
|
||||
core.exportVariable(String(EnvVar.FEATURE_SANDWICH), "false");
|
||||
core.exportVariable(String(EnvVar.FEATURE_SARIF_COMBINE), "true");
|
||||
core.exportVariable(String(EnvVar.FEATURE_WILL_UPLOAD), "true");
|
||||
core.exportVariable(String(EnvVar.FEATURE_RAM_2023), "true");
|
||||
core.exportVariable(String(EnvVar.VERSION), version);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user