Remove CodeQL version guards for 2.11.5 and earlier
This commit is contained in:
parent
649145214e
commit
a36fc67ec3
12 changed files with 14 additions and 114 deletions
|
|
@ -951,58 +951,6 @@ test("does not pass a qlconfig to the CLI when it is undefined", async (t: Execu
|
|||
});
|
||||
});
|
||||
|
||||
test("databaseInterpretResults() sets --sarif-add-baseline-file-info for 2.11.3", async (t) => {
|
||||
const runnerConstructorStub = stubToolRunnerConstructor();
|
||||
const codeqlObject = await codeql.getCodeQLForTesting();
|
||||
sinon.stub(codeqlObject, "getVersion").resolves(makeVersionInfo("2.11.3"));
|
||||
// safeWhich throws because of the test CodeQL object.
|
||||
sinon.stub(safeWhich, "safeWhich").resolves("");
|
||||
await codeqlObject.databaseInterpretResults(
|
||||
"",
|
||||
[],
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"-v",
|
||||
"",
|
||||
stubConfig,
|
||||
createFeatures([]),
|
||||
getRunnerLogger(true),
|
||||
);
|
||||
t.true(
|
||||
runnerConstructorStub.firstCall.args[1].includes(
|
||||
"--sarif-add-baseline-file-info",
|
||||
),
|
||||
"--sarif-add-baseline-file-info should be present, but it is absent",
|
||||
);
|
||||
});
|
||||
|
||||
test("databaseInterpretResults() does not set --sarif-add-baseline-file-info for 2.11.2", async (t) => {
|
||||
const runnerConstructorStub = stubToolRunnerConstructor();
|
||||
const codeqlObject = await codeql.getCodeQLForTesting();
|
||||
sinon.stub(codeqlObject, "getVersion").resolves(makeVersionInfo("2.11.2"));
|
||||
// safeWhich throws because of the test CodeQL object.
|
||||
sinon.stub(safeWhich, "safeWhich").resolves("");
|
||||
await codeqlObject.databaseInterpretResults(
|
||||
"",
|
||||
[],
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"-v",
|
||||
"",
|
||||
stubConfig,
|
||||
createFeatures([]),
|
||||
getRunnerLogger(true),
|
||||
);
|
||||
t.false(
|
||||
runnerConstructorStub.firstCall.args[1].includes(
|
||||
"--sarif-add-baseline-file-info",
|
||||
),
|
||||
"--sarif-add-baseline-file-info must be absent, but it is present",
|
||||
);
|
||||
});
|
||||
|
||||
const NEW_ANALYSIS_SUMMARY_TEST_CASES = [
|
||||
{
|
||||
codeqlVersion: "2.15.0",
|
||||
|
|
|
|||
|
|
@ -317,15 +317,7 @@ const GHES_MOST_RECENT_DEPRECATION_DATE = "2023-11-08";
|
|||
*/
|
||||
|
||||
/**
|
||||
* Versions 2.11.3+ of the CodeQL CLI support exporting a failed SARIF file via
|
||||
* `codeql database export-diagnostics` or `codeql diagnostics export`.
|
||||
*/
|
||||
export const CODEQL_VERSION_EXPORT_FAILED_SARIF = "2.11.3";
|
||||
|
||||
const CODEQL_VERSION_FILE_BASELINE_INFORMATION = "2.11.3";
|
||||
|
||||
/**
|
||||
* Versions 2.11.1+ of the CodeQL Bundle include a `security-experimental` built-in query suite for
|
||||
* Versions 2.12.1+ of the CodeQL Bundle include a `security-experimental` built-in query suite for
|
||||
* each language.
|
||||
*/
|
||||
export const CODEQL_VERSION_SECURITY_EXPERIMENTAL_SUITE = "2.12.1";
|
||||
|
|
@ -905,6 +897,7 @@ export async function getCodeQLForCmd(
|
|||
addSnippetsFlag,
|
||||
"--print-diagnostics-summary",
|
||||
"--print-metrics-summary",
|
||||
"--sarif-add-baseline-file-info",
|
||||
"--sarif-add-query-help",
|
||||
"--sarif-group-rules-by-pack",
|
||||
...(await getCodeScanningConfigExportArguments(config, this)),
|
||||
|
|
@ -913,14 +906,6 @@ export async function getCodeQLForCmd(
|
|||
if (automationDetailsId !== undefined) {
|
||||
codeqlArgs.push("--sarif-category", automationDetailsId);
|
||||
}
|
||||
if (
|
||||
await util.codeQlVersionAbove(
|
||||
this,
|
||||
CODEQL_VERSION_FILE_BASELINE_INFORMATION,
|
||||
)
|
||||
) {
|
||||
codeqlArgs.push("--sarif-add-baseline-file-info");
|
||||
}
|
||||
if (await isSublanguageFileCoverageEnabled(config, this)) {
|
||||
codeqlArgs.push("--sublanguage-file-coverage");
|
||||
} else if (
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ export const featureConfig: Record<
|
|||
},
|
||||
[Feature.CliConfigFileEnabled]: {
|
||||
envVar: "CODEQL_PASS_CONFIG_TO_CLI",
|
||||
minimumVersion: "2.11.6",
|
||||
minimumVersion: undefined,
|
||||
defaultValue: true,
|
||||
},
|
||||
[Feature.EvaluatorFineGrainedParallelismEnabled]: {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import * as actionsUtil from "./actions-util";
|
||||
import { getApiClient } from "./api-client";
|
||||
import { CODEQL_VERSION_EXPORT_FAILED_SARIF, getCodeQL } from "./codeql";
|
||||
import { getCodeQL } from "./codeql";
|
||||
import { Config, getConfig } from "./config-utils";
|
||||
import { EnvVar } from "./environment";
|
||||
import { Feature, FeatureEnablement } from "./feature-flags";
|
||||
|
|
@ -8,7 +8,6 @@ import { Logger } from "./logging";
|
|||
import { RepositoryNwo, parseRepositoryNwo } from "./repository";
|
||||
import * as uploadLib from "./upload-lib";
|
||||
import {
|
||||
codeQlVersionAbove,
|
||||
delay,
|
||||
getErrorMessage,
|
||||
getRequiredEnvParam,
|
||||
|
|
@ -58,10 +57,6 @@ async function maybeUploadFailedSarif(
|
|||
if (!config.codeQLCmd) {
|
||||
return { upload_failed_run_skipped_because: "CodeQL command not found" };
|
||||
}
|
||||
const codeql = await getCodeQL(config.codeQLCmd);
|
||||
if (!(await codeQlVersionAbove(codeql, CODEQL_VERSION_EXPORT_FAILED_SARIF))) {
|
||||
return { upload_failed_run_skipped_because: "Unsupported by CodeQL CLI" };
|
||||
}
|
||||
const workflow = await getWorkflow(logger);
|
||||
const jobName = getRequiredEnvParam("GITHUB_JOB");
|
||||
const matrix = parseMatrixInput(actionsUtil.getRequiredInput("matrix"));
|
||||
|
|
@ -78,6 +73,7 @@ async function maybeUploadFailedSarif(
|
|||
const checkoutPath = getCheckoutPathInputOrThrow(workflow, jobName, matrix);
|
||||
const databasePath = config.dbLocation;
|
||||
|
||||
const codeql = await getCodeQL(config.codeQLCmd);
|
||||
const sarifFile = "../codeql-failed-run.sarif";
|
||||
|
||||
// If there is no database or the feature flag is off, we run 'export diagnostics'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue