Do not set --expect-discarded-cache on "cleanup-level: overlay"
When a user specifies "cleanup-level: overlay", it suggests that the user wishes to preserve the evaluation cache for future use. So in this case we should not set --expect-discarded-cache when running queries.
This commit is contained in:
parent
b2e6519679
commit
d76f393713
5 changed files with 18 additions and 15 deletions
|
|
@ -295,12 +295,16 @@ async function run() {
|
|||
logger,
|
||||
);
|
||||
|
||||
const cleanupLevel =
|
||||
actionsUtil.getOptionalInput("cleanup-level") || "brutal";
|
||||
|
||||
if (actionsUtil.getRequiredInput("skip-queries") !== "true") {
|
||||
runStats = await runQueries(
|
||||
outputDir,
|
||||
memory,
|
||||
util.getAddSnippetsFlag(actionsUtil.getRequiredInput("add-snippets")),
|
||||
threads,
|
||||
cleanupLevel,
|
||||
diffRangePackDir,
|
||||
actionsUtil.getOptionalInput("category"),
|
||||
config,
|
||||
|
|
@ -309,12 +313,8 @@ async function run() {
|
|||
);
|
||||
}
|
||||
|
||||
if (actionsUtil.getOptionalInput("cleanup-level") !== "none") {
|
||||
await runCleanup(
|
||||
config,
|
||||
actionsUtil.getOptionalInput("cleanup-level") || "brutal",
|
||||
logger,
|
||||
);
|
||||
if (cleanupLevel !== "none") {
|
||||
await runCleanup(config, cleanupLevel, logger);
|
||||
}
|
||||
|
||||
const dbLocations: { [lang: string]: string } = {};
|
||||
|
|
|
|||
|
|
@ -101,6 +101,7 @@ test("status report fields", async (t) => {
|
|||
memoryFlag,
|
||||
addSnippetsFlag,
|
||||
threadsFlag,
|
||||
"brutal",
|
||||
undefined,
|
||||
undefined,
|
||||
config,
|
||||
|
|
|
|||
|
|
@ -548,6 +548,7 @@ export async function runQueries(
|
|||
memoryFlag: string,
|
||||
addSnippetsFlag: string,
|
||||
threadsFlag: string,
|
||||
cleanupLevel: string,
|
||||
diffRangePackDir: string | undefined,
|
||||
automationDetailsId: string | undefined,
|
||||
config: configUtils.Config,
|
||||
|
|
@ -555,20 +556,22 @@ export async function runQueries(
|
|||
features: FeatureEnablement,
|
||||
): Promise<QueriesStatusReport> {
|
||||
const statusReport: QueriesStatusReport = {};
|
||||
const queryFlags = [memoryFlag, threadsFlag];
|
||||
|
||||
if (cleanupLevel !== "overlay") {
|
||||
queryFlags.push("--expect-discarded-cache");
|
||||
}
|
||||
|
||||
statusReport.analysis_is_diff_informed = diffRangePackDir !== undefined;
|
||||
const dataExtensionFlags = diffRangePackDir
|
||||
? [
|
||||
`--additional-packs=${diffRangePackDir}`,
|
||||
"--extension-packs=codeql-action/pr-diff-range",
|
||||
]
|
||||
: [];
|
||||
if (diffRangePackDir) {
|
||||
queryFlags.push(`--additional-packs=${diffRangePackDir}`);
|
||||
queryFlags.push("--extension-packs=codeql-action/pr-diff-range");
|
||||
}
|
||||
const sarifRunPropertyFlag = diffRangePackDir
|
||||
? "--sarif-run-property=incrementalMode=diff-informed"
|
||||
: undefined;
|
||||
|
||||
const codeql = await getCodeQL(config.codeQLCmd);
|
||||
const queryFlags = [memoryFlag, threadsFlag, ...dataExtensionFlags];
|
||||
|
||||
for (const language of config.languages) {
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -957,7 +957,7 @@ test("runTool recognizes fatal internal errors", async (t) => {
|
|||
await codeqlObject.databaseRunQueries(stubConfig.dbLocation, []),
|
||||
{
|
||||
instanceOf: CliError,
|
||||
message: `Encountered a fatal error while running "codeql-for-testing database run-queries --expect-discarded-cache --intra-layer-parallelism --min-disk-free=1024 -v". Exit code was 1 and error was: Oops! A fatal internal error occurred. Details:
|
||||
message: `Encountered a fatal error while running "codeql-for-testing database run-queries --intra-layer-parallelism --min-disk-free=1024 -v". Exit code was 1 and error was: Oops! A fatal internal error occurred. Details:
|
||||
com.semmle.util.exception.CatastrophicError: An error occurred while evaluating ControlFlowGraph::ControlFlow::Root.isRootOf/1#dispred#f610e6ed/2@86282cc8
|
||||
Severe disk cache trouble (corruption or out of space) at /home/runner/work/_temp/codeql_databases/go/db-go/default/cache/pages/28/33.pack: Failed to write item to disk. See the logs for more details.`,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -805,7 +805,6 @@ export async function getCodeQLForCmd(
|
|||
"run-queries",
|
||||
...flags,
|
||||
databasePath,
|
||||
"--expect-discarded-cache",
|
||||
"--intra-layer-parallelism",
|
||||
"--min-disk-free=1024", // Try to leave at least 1GB free
|
||||
"-v",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue