Compare commits

...

2 Commits

Author SHA1 Message Date
github-actions[bot]
ff1dba567b Rebuild 2023-12-11 17:48:28 +00:00
Henning Makholm
ba2492c508 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.
2023-12-11 18:29:36 +01:00
6 changed files with 37 additions and 2 deletions

6
lib/environment.js generated
View File

@@ -26,6 +26,12 @@ var EnvVar;
EnvVar["FEATURE_SARIF_COMBINE"] = "CODEQL_ACTION_FEATURE_SARIF_COMBINE";
/** Whether the CodeQL Action will upload SARIF, not the CLI. */
EnvVar["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.
*/
EnvVar["FEATURE_RAM_2023"] = "CODEQL_ACTION_FEATURE_RAM_2023";
/** Whether the CodeQL Action has already warned the user about low disk space. */
EnvVar["HAS_WARNED_ABOUT_DISK_SPACE"] = "CODEQL_ACTION_HAS_WARNED_ABOUT_DISK_SPACE";
/** UUID representing the current job run. */

View File

@@ -1 +1 @@
{"version":3,"file":"environment.js","sourceRoot":"","sources":["../src/environment.ts"],"names":[],"mappings":";;;AAAA,IAAY,MAsEX;AAtED,WAAY,MAAM;IAChB,2DAA2D;IAC3D,+FAAqF,CAAA;IAErF,gEAAgE;IAChE,qEAA2D,CAAA;IAE3D;;;OAGG;IACH,yFAA+E,CAAA;IAE/E;;;OAGG;IACH,yEAA+D,CAAA;IAE/D,gF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A6EjB"}

11
lib/util.js generated
View File

@@ -113,6 +113,16 @@ exports.withTmpDir = withTmpDir;
* 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(totalMemoryMegaBytes, platform) {
@@ -393,6 +403,7 @@ function initializeEnvironment(version) {
core.exportVariable(String(environment_1.EnvVar.FEATURE_SANDWICH), "false");
core.exportVariable(String(environment_1.EnvVar.FEATURE_SARIF_COMBINE), "true");
core.exportVariable(String(environment_1.EnvVar.FEATURE_WILL_UPLOAD), "true");
core.exportVariable(String(environment_1.EnvVar.FEATURE_RAM_2023), "true");
core.exportVariable(String(environment_1.EnvVar.VERSION), version);
}
exports.initializeEnvironment = initializeEnvironment;

File diff suppressed because one or more lines are too long

View File

@@ -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",

View File

@@ -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);
}