mirror of
https://github.com/github/codeql-action.git
synced 2026-10-03 09:14:58 +00:00
Merge pull request #2991 from github/koesie10/remove-disable-combine-sarif-files-ff
Remove `disable_combine_sarif_files` feature flag
This commit is contained in:
6
lib/feature-flags.js
generated
6
lib/feature-flags.js
generated
@@ -62,7 +62,6 @@ var Feature;
|
||||
Feature["CppBuildModeNone"] = "cpp_build_mode_none";
|
||||
Feature["CppDependencyInstallation"] = "cpp_dependency_installation_enabled";
|
||||
Feature["DiffInformedQueries"] = "diff_informed_queries";
|
||||
Feature["DisableCombineSarifFiles"] = "disable_combine_sarif_files";
|
||||
Feature["DisableCsharpBuildless"] = "disable_csharp_buildless";
|
||||
Feature["DisableJavaBuildlessEnabled"] = "disable_java_buildless_enabled";
|
||||
Feature["DisableKotlinAnalysisEnabled"] = "disable_kotlin_analysis_enabled";
|
||||
@@ -121,11 +120,6 @@ exports.featureConfig = {
|
||||
envVar: "CODEQL_ACTION_DIFF_INFORMED_QUERIES",
|
||||
minimumVersion: "2.21.0",
|
||||
},
|
||||
[Feature.DisableCombineSarifFiles]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_DISABLE_COMBINE_SARIF_FILES",
|
||||
minimumVersion: undefined,
|
||||
},
|
||||
[Feature.DisableCsharpBuildless]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_DISABLE_CSHARP_BUILDLESS",
|
||||
|
||||
File diff suppressed because one or more lines are too long
19
lib/upload-lib.js
generated
19
lib/upload-lib.js
generated
@@ -64,7 +64,6 @@ const codeql_1 = require("./codeql");
|
||||
const config_utils_1 = require("./config-utils");
|
||||
const diff_informed_analysis_utils_1 = require("./diff-informed-analysis-utils");
|
||||
const environment_1 = require("./environment");
|
||||
const feature_flags_1 = require("./feature-flags");
|
||||
const fingerprints = __importStar(require("./fingerprints"));
|
||||
const gitUtils = __importStar(require("./git-utils"));
|
||||
const init_1 = require("./init");
|
||||
@@ -146,27 +145,21 @@ async function shouldShowCombineSarifFilesDeprecationWarning(sarifObjects, githu
|
||||
return (!areAllRunsUnique(sarifObjects) &&
|
||||
!process.env.CODEQL_MERGE_SARIF_DEPRECATION_WARNING);
|
||||
}
|
||||
async function throwIfCombineSarifFilesDisabled(sarifObjects, features, githubVersion) {
|
||||
if (!(await shouldDisableCombineSarifFiles(sarifObjects, features, githubVersion))) {
|
||||
async function throwIfCombineSarifFilesDisabled(sarifObjects, githubVersion) {
|
||||
if (!(await shouldDisableCombineSarifFiles(sarifObjects, githubVersion))) {
|
||||
return;
|
||||
}
|
||||
const deprecationMoreInformationMessage = "For more information, see https://github.blog/changelog/2025-07-21-code-scanning-will-stop-combining-multiple-sarif-runs-uploaded-in-the-same-sarif-file/";
|
||||
throw new util_1.ConfigurationError(`The CodeQL Action does not support uploading multiple SARIF runs with the same category. Please update your workflow to upload a single run per category. ${deprecationMoreInformationMessage}`);
|
||||
}
|
||||
// Checks whether combining SARIF files should be disabled.
|
||||
async function shouldDisableCombineSarifFiles(sarifObjects, features, githubVersion) {
|
||||
async function shouldDisableCombineSarifFiles(sarifObjects, githubVersion) {
|
||||
if (githubVersion.type === util_1.GitHubVariant.GHES) {
|
||||
// Never block on GHES versions before 3.18.
|
||||
if ((0, util_1.satisfiesGHESVersion)(githubVersion.version, "<3.18", true)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Never block when the feature flag is disabled.
|
||||
if (!(await features.getValue(feature_flags_1.Feature.DisableCombineSarifFiles))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (areAllRunsUnique(sarifObjects)) {
|
||||
// If all runs are unique, we can safely combine them.
|
||||
return false;
|
||||
@@ -189,7 +182,7 @@ async function combineSarifFilesUsingCLI(sarifFiles, gitHubVersion, features, lo
|
||||
: "and will be removed in July 2025";
|
||||
const deprecationMoreInformationMessage = "For more information, see https://github.blog/changelog/2024-05-06-code-scanning-will-stop-combining-runs-from-a-single-upload";
|
||||
if (!areAllRunsProducedByCodeQL(sarifObjects)) {
|
||||
await throwIfCombineSarifFilesDisabled(sarifObjects, features, gitHubVersion);
|
||||
await throwIfCombineSarifFilesDisabled(sarifObjects, gitHubVersion);
|
||||
logger.debug("Not all SARIF files were produced by CodeQL. Merging files in the action.");
|
||||
if (await shouldShowCombineSarifFilesDeprecationWarning(sarifObjects, gitHubVersion)) {
|
||||
logger.warning(`Uploading multiple SARIF runs with the same category is deprecated ${deprecationWarningMessage}. Please update your workflow to upload a single run per category. ${deprecationMoreInformationMessage}`);
|
||||
@@ -221,7 +214,7 @@ async function combineSarifFilesUsingCLI(sarifFiles, gitHubVersion, features, lo
|
||||
codeQL = initCodeQLResult.codeql;
|
||||
}
|
||||
if (!(await codeQL.supportsFeature(tools_features_1.ToolsFeature.SarifMergeRunsFromEqualCategory))) {
|
||||
await throwIfCombineSarifFilesDisabled(sarifObjects, features, gitHubVersion);
|
||||
await throwIfCombineSarifFilesDisabled(sarifObjects, gitHubVersion);
|
||||
logger.warning("The CodeQL CLI does not support merging SARIF files. Merging files in the action.");
|
||||
if (await shouldShowCombineSarifFilesDeprecationWarning(sarifObjects, gitHubVersion)) {
|
||||
logger.warning(`Uploading multiple CodeQL runs with the same category is deprecated ${deprecationWarningMessage} for CodeQL CLI 2.16.6 and earlier. Please update your CodeQL CLI version or update your workflow to set a distinct category for each CodeQL run. ${deprecationMoreInformationMessage}`);
|
||||
@@ -488,7 +481,7 @@ async function uploadSpecifiedFiles(sarifPaths, checkoutPath, category, features
|
||||
sarif = readSarifFile(sarifPath);
|
||||
validateSarifFileSchema(sarif, sarifPath, logger);
|
||||
// Validate that there are no runs for the same category
|
||||
await throwIfCombineSarifFilesDisabled([sarif], features, gitHubVersion);
|
||||
await throwIfCombineSarifFilesDisabled([sarif], gitHubVersion);
|
||||
}
|
||||
sarif = filterAlertsByDiffRange(logger, sarif);
|
||||
sarif = await fingerprints.addFingerprints(sarif, checkoutPath, logger);
|
||||
|
||||
File diff suppressed because one or more lines are too long
30
lib/upload-lib.test.js
generated
30
lib/upload-lib.test.js
generated
@@ -39,7 +39,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const fs = __importStar(require("fs"));
|
||||
const path = __importStar(require("path"));
|
||||
const ava_1 = __importDefault(require("ava"));
|
||||
const feature_flags_1 = require("./feature-flags");
|
||||
const logging_1 = require("./logging");
|
||||
const testing_utils_1 = require("./testing-utils");
|
||||
const uploadLib = __importStar(require("./upload-lib"));
|
||||
@@ -263,38 +262,33 @@ ava_1.default.beforeEach(() => {
|
||||
type: util_1.GitHubVariant.DOTCOM,
|
||||
}));
|
||||
});
|
||||
(0, ava_1.default)("throwIfCombineSarifFilesDisabled when on dotcom with feature flag", async (t) => {
|
||||
await t.throwsAsync(uploadLib.throwIfCombineSarifFilesDisabled([createMockSarif("abc", "def"), createMockSarif("abc", "def")], (0, testing_utils_1.createFeatures)([feature_flags_1.Feature.DisableCombineSarifFiles]), {
|
||||
(0, ava_1.default)("throwIfCombineSarifFilesDisabled when on dotcom", async (t) => {
|
||||
await t.throwsAsync(uploadLib.throwIfCombineSarifFilesDisabled([createMockSarif("abc", "def"), createMockSarif("abc", "def")], {
|
||||
type: util_1.GitHubVariant.DOTCOM,
|
||||
}), {
|
||||
message: /The CodeQL Action does not support uploading multiple SARIF runs with the same category/,
|
||||
});
|
||||
});
|
||||
(0, ava_1.default)("throwIfCombineSarifFilesDisabled when on dotcom without feature flag", async (t) => {
|
||||
await t.notThrowsAsync(uploadLib.throwIfCombineSarifFilesDisabled([createMockSarif("abc", "def"), createMockSarif("abc", "def")], (0, testing_utils_1.createFeatures)([]), {
|
||||
type: util_1.GitHubVariant.DOTCOM,
|
||||
}));
|
||||
});
|
||||
(0, ava_1.default)("throwIfCombineSarifFilesDisabled when on GHES 3.13", async (t) => {
|
||||
await t.notThrowsAsync(uploadLib.throwIfCombineSarifFilesDisabled([createMockSarif("abc", "def"), createMockSarif("abc", "def")], (0, testing_utils_1.createFeatures)([]), {
|
||||
await t.notThrowsAsync(uploadLib.throwIfCombineSarifFilesDisabled([createMockSarif("abc", "def"), createMockSarif("abc", "def")], {
|
||||
type: util_1.GitHubVariant.GHES,
|
||||
version: "3.13.2",
|
||||
}));
|
||||
});
|
||||
(0, ava_1.default)("throwIfCombineSarifFilesDisabled when on GHES 3.14", async (t) => {
|
||||
await t.notThrowsAsync(uploadLib.throwIfCombineSarifFilesDisabled([createMockSarif("abc", "def"), createMockSarif("abc", "def")], (0, testing_utils_1.createFeatures)([]), {
|
||||
await t.notThrowsAsync(uploadLib.throwIfCombineSarifFilesDisabled([createMockSarif("abc", "def"), createMockSarif("abc", "def")], {
|
||||
type: util_1.GitHubVariant.GHES,
|
||||
version: "3.14.0",
|
||||
}));
|
||||
});
|
||||
(0, ava_1.default)("throwIfCombineSarifFilesDisabled when on GHES 3.17", async (t) => {
|
||||
await t.notThrowsAsync(uploadLib.throwIfCombineSarifFilesDisabled([createMockSarif("abc", "def"), createMockSarif("abc", "def")], (0, testing_utils_1.createFeatures)([]), {
|
||||
await t.notThrowsAsync(uploadLib.throwIfCombineSarifFilesDisabled([createMockSarif("abc", "def"), createMockSarif("abc", "def")], {
|
||||
type: util_1.GitHubVariant.GHES,
|
||||
version: "3.17.0",
|
||||
}));
|
||||
});
|
||||
(0, ava_1.default)("throwIfCombineSarifFilesDisabled when on GHES 3.18 pre", async (t) => {
|
||||
await t.throwsAsync(uploadLib.throwIfCombineSarifFilesDisabled([createMockSarif("abc", "def"), createMockSarif("abc", "def")], (0, testing_utils_1.createFeatures)([]), {
|
||||
await t.throwsAsync(uploadLib.throwIfCombineSarifFilesDisabled([createMockSarif("abc", "def"), createMockSarif("abc", "def")], {
|
||||
type: util_1.GitHubVariant.GHES,
|
||||
version: "3.18.0.pre1",
|
||||
}), {
|
||||
@@ -302,7 +296,7 @@ ava_1.default.beforeEach(() => {
|
||||
});
|
||||
});
|
||||
(0, ava_1.default)("throwIfCombineSarifFilesDisabled when on GHES 3.18 alpha", async (t) => {
|
||||
await t.throwsAsync(uploadLib.throwIfCombineSarifFilesDisabled([createMockSarif("abc", "def"), createMockSarif("abc", "def")], (0, testing_utils_1.createFeatures)([]), {
|
||||
await t.throwsAsync(uploadLib.throwIfCombineSarifFilesDisabled([createMockSarif("abc", "def"), createMockSarif("abc", "def")], {
|
||||
type: util_1.GitHubVariant.GHES,
|
||||
version: "3.18.0-alpha.1",
|
||||
}), {
|
||||
@@ -310,7 +304,7 @@ ava_1.default.beforeEach(() => {
|
||||
});
|
||||
});
|
||||
(0, ava_1.default)("throwIfCombineSarifFilesDisabled when on GHES 3.18", async (t) => {
|
||||
await t.throwsAsync(uploadLib.throwIfCombineSarifFilesDisabled([createMockSarif("abc", "def"), createMockSarif("abc", "def")], (0, testing_utils_1.createFeatures)([]), {
|
||||
await t.throwsAsync(uploadLib.throwIfCombineSarifFilesDisabled([createMockSarif("abc", "def"), createMockSarif("abc", "def")], {
|
||||
type: util_1.GitHubVariant.GHES,
|
||||
version: "3.18.0",
|
||||
}), {
|
||||
@@ -318,23 +312,23 @@ ava_1.default.beforeEach(() => {
|
||||
});
|
||||
});
|
||||
(0, ava_1.default)("throwIfCombineSarifFilesDisabled with an invalid GHES version", async (t) => {
|
||||
await t.notThrowsAsync(uploadLib.throwIfCombineSarifFilesDisabled([createMockSarif("abc", "def"), createMockSarif("abc", "def")], (0, testing_utils_1.createFeatures)([]), {
|
||||
await t.notThrowsAsync(uploadLib.throwIfCombineSarifFilesDisabled([createMockSarif("abc", "def"), createMockSarif("abc", "def")], {
|
||||
type: util_1.GitHubVariant.GHES,
|
||||
version: "foobar",
|
||||
}));
|
||||
});
|
||||
(0, ava_1.default)("throwIfCombineSarifFilesDisabled with only 1 run", async (t) => {
|
||||
await t.notThrowsAsync(uploadLib.throwIfCombineSarifFilesDisabled([createMockSarif("abc", "def")], (0, testing_utils_1.createFeatures)([feature_flags_1.Feature.DisableCombineSarifFiles]), {
|
||||
await t.notThrowsAsync(uploadLib.throwIfCombineSarifFilesDisabled([createMockSarif("abc", "def")], {
|
||||
type: util_1.GitHubVariant.DOTCOM,
|
||||
}));
|
||||
});
|
||||
(0, ava_1.default)("throwIfCombineSarifFilesDisabled with distinct categories", async (t) => {
|
||||
await t.notThrowsAsync(uploadLib.throwIfCombineSarifFilesDisabled([createMockSarif("abc", "def"), createMockSarif("def", "def")], (0, testing_utils_1.createFeatures)([feature_flags_1.Feature.DisableCombineSarifFiles]), {
|
||||
await t.notThrowsAsync(uploadLib.throwIfCombineSarifFilesDisabled([createMockSarif("abc", "def"), createMockSarif("def", "def")], {
|
||||
type: util_1.GitHubVariant.DOTCOM,
|
||||
}));
|
||||
});
|
||||
(0, ava_1.default)("throwIfCombineSarifFilesDisabled with distinct tools", async (t) => {
|
||||
await t.notThrowsAsync(uploadLib.throwIfCombineSarifFilesDisabled([createMockSarif("abc", "abc"), createMockSarif("abc", "def")], (0, testing_utils_1.createFeatures)([feature_flags_1.Feature.DisableCombineSarifFiles]), {
|
||||
await t.notThrowsAsync(uploadLib.throwIfCombineSarifFilesDisabled([createMockSarif("abc", "abc"), createMockSarif("abc", "def")], {
|
||||
type: util_1.GitHubVariant.DOTCOM,
|
||||
}));
|
||||
});
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -47,7 +47,6 @@ export enum Feature {
|
||||
CppBuildModeNone = "cpp_build_mode_none",
|
||||
CppDependencyInstallation = "cpp_dependency_installation_enabled",
|
||||
DiffInformedQueries = "diff_informed_queries",
|
||||
DisableCombineSarifFiles = "disable_combine_sarif_files",
|
||||
DisableCsharpBuildless = "disable_csharp_buildless",
|
||||
DisableJavaBuildlessEnabled = "disable_java_buildless_enabled",
|
||||
DisableKotlinAnalysisEnabled = "disable_kotlin_analysis_enabled",
|
||||
@@ -137,11 +136,6 @@ export const featureConfig: Record<
|
||||
envVar: "CODEQL_ACTION_DIFF_INFORMED_QUERIES",
|
||||
minimumVersion: "2.21.0",
|
||||
},
|
||||
[Feature.DisableCombineSarifFiles]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_DISABLE_COMBINE_SARIF_FILES",
|
||||
minimumVersion: undefined,
|
||||
},
|
||||
[Feature.DisableCsharpBuildless]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_DISABLE_CSHARP_BUILDLESS",
|
||||
|
||||
@@ -3,9 +3,8 @@ import * as path from "path";
|
||||
|
||||
import test from "ava";
|
||||
|
||||
import { Feature } from "./feature-flags";
|
||||
import { getRunnerLogger, Logger } from "./logging";
|
||||
import { createFeatures, setupTests } from "./testing-utils";
|
||||
import { setupTests } from "./testing-utils";
|
||||
import * as uploadLib from "./upload-lib";
|
||||
import { GitHubVariant, initializeEnvironment, withTmpDir } from "./util";
|
||||
|
||||
@@ -457,11 +456,10 @@ test("shouldShowCombineSarifFilesDeprecationWarning when environment variable is
|
||||
);
|
||||
});
|
||||
|
||||
test("throwIfCombineSarifFilesDisabled when on dotcom with feature flag", async (t) => {
|
||||
test("throwIfCombineSarifFilesDisabled when on dotcom", async (t) => {
|
||||
await t.throwsAsync(
|
||||
uploadLib.throwIfCombineSarifFilesDisabled(
|
||||
[createMockSarif("abc", "def"), createMockSarif("abc", "def")],
|
||||
createFeatures([Feature.DisableCombineSarifFiles]),
|
||||
{
|
||||
type: GitHubVariant.DOTCOM,
|
||||
},
|
||||
@@ -473,23 +471,10 @@ test("throwIfCombineSarifFilesDisabled when on dotcom with feature flag", async
|
||||
);
|
||||
});
|
||||
|
||||
test("throwIfCombineSarifFilesDisabled when on dotcom without feature flag", async (t) => {
|
||||
await t.notThrowsAsync(
|
||||
uploadLib.throwIfCombineSarifFilesDisabled(
|
||||
[createMockSarif("abc", "def"), createMockSarif("abc", "def")],
|
||||
createFeatures([]),
|
||||
{
|
||||
type: GitHubVariant.DOTCOM,
|
||||
},
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
test("throwIfCombineSarifFilesDisabled when on GHES 3.13", async (t) => {
|
||||
await t.notThrowsAsync(
|
||||
uploadLib.throwIfCombineSarifFilesDisabled(
|
||||
[createMockSarif("abc", "def"), createMockSarif("abc", "def")],
|
||||
createFeatures([]),
|
||||
{
|
||||
type: GitHubVariant.GHES,
|
||||
version: "3.13.2",
|
||||
@@ -502,7 +487,6 @@ test("throwIfCombineSarifFilesDisabled when on GHES 3.14", async (t) => {
|
||||
await t.notThrowsAsync(
|
||||
uploadLib.throwIfCombineSarifFilesDisabled(
|
||||
[createMockSarif("abc", "def"), createMockSarif("abc", "def")],
|
||||
createFeatures([]),
|
||||
{
|
||||
type: GitHubVariant.GHES,
|
||||
version: "3.14.0",
|
||||
@@ -515,7 +499,6 @@ test("throwIfCombineSarifFilesDisabled when on GHES 3.17", async (t) => {
|
||||
await t.notThrowsAsync(
|
||||
uploadLib.throwIfCombineSarifFilesDisabled(
|
||||
[createMockSarif("abc", "def"), createMockSarif("abc", "def")],
|
||||
createFeatures([]),
|
||||
{
|
||||
type: GitHubVariant.GHES,
|
||||
version: "3.17.0",
|
||||
@@ -528,7 +511,6 @@ test("throwIfCombineSarifFilesDisabled when on GHES 3.18 pre", async (t) => {
|
||||
await t.throwsAsync(
|
||||
uploadLib.throwIfCombineSarifFilesDisabled(
|
||||
[createMockSarif("abc", "def"), createMockSarif("abc", "def")],
|
||||
createFeatures([]),
|
||||
{
|
||||
type: GitHubVariant.GHES,
|
||||
version: "3.18.0.pre1",
|
||||
@@ -545,7 +527,6 @@ test("throwIfCombineSarifFilesDisabled when on GHES 3.18 alpha", async (t) => {
|
||||
await t.throwsAsync(
|
||||
uploadLib.throwIfCombineSarifFilesDisabled(
|
||||
[createMockSarif("abc", "def"), createMockSarif("abc", "def")],
|
||||
createFeatures([]),
|
||||
{
|
||||
type: GitHubVariant.GHES,
|
||||
version: "3.18.0-alpha.1",
|
||||
@@ -562,7 +543,6 @@ test("throwIfCombineSarifFilesDisabled when on GHES 3.18", async (t) => {
|
||||
await t.throwsAsync(
|
||||
uploadLib.throwIfCombineSarifFilesDisabled(
|
||||
[createMockSarif("abc", "def"), createMockSarif("abc", "def")],
|
||||
createFeatures([]),
|
||||
{
|
||||
type: GitHubVariant.GHES,
|
||||
version: "3.18.0",
|
||||
@@ -579,7 +559,6 @@ test("throwIfCombineSarifFilesDisabled with an invalid GHES version", async (t)
|
||||
await t.notThrowsAsync(
|
||||
uploadLib.throwIfCombineSarifFilesDisabled(
|
||||
[createMockSarif("abc", "def"), createMockSarif("abc", "def")],
|
||||
createFeatures([]),
|
||||
{
|
||||
type: GitHubVariant.GHES,
|
||||
version: "foobar",
|
||||
@@ -592,7 +571,6 @@ test("throwIfCombineSarifFilesDisabled with only 1 run", async (t) => {
|
||||
await t.notThrowsAsync(
|
||||
uploadLib.throwIfCombineSarifFilesDisabled(
|
||||
[createMockSarif("abc", "def")],
|
||||
createFeatures([Feature.DisableCombineSarifFiles]),
|
||||
{
|
||||
type: GitHubVariant.DOTCOM,
|
||||
},
|
||||
@@ -604,7 +582,6 @@ test("throwIfCombineSarifFilesDisabled with distinct categories", async (t) => {
|
||||
await t.notThrowsAsync(
|
||||
uploadLib.throwIfCombineSarifFilesDisabled(
|
||||
[createMockSarif("abc", "def"), createMockSarif("def", "def")],
|
||||
createFeatures([Feature.DisableCombineSarifFiles]),
|
||||
{
|
||||
type: GitHubVariant.DOTCOM,
|
||||
},
|
||||
@@ -616,7 +593,6 @@ test("throwIfCombineSarifFilesDisabled with distinct tools", async (t) => {
|
||||
await t.notThrowsAsync(
|
||||
uploadLib.throwIfCombineSarifFilesDisabled(
|
||||
[createMockSarif("abc", "abc"), createMockSarif("abc", "def")],
|
||||
createFeatures([Feature.DisableCombineSarifFiles]),
|
||||
{
|
||||
type: GitHubVariant.DOTCOM,
|
||||
},
|
||||
|
||||
@@ -14,7 +14,7 @@ import { CodeQL, getCodeQL } from "./codeql";
|
||||
import { getConfig } from "./config-utils";
|
||||
import { readDiffRangesJsonFile } from "./diff-informed-analysis-utils";
|
||||
import { EnvVar } from "./environment";
|
||||
import { Feature, FeatureEnablement } from "./feature-flags";
|
||||
import { FeatureEnablement } from "./feature-flags";
|
||||
import * as fingerprints from "./fingerprints";
|
||||
import * as gitUtils from "./git-utils";
|
||||
import { initCodeQL } from "./init";
|
||||
@@ -146,16 +146,9 @@ export async function shouldShowCombineSarifFilesDeprecationWarning(
|
||||
|
||||
export async function throwIfCombineSarifFilesDisabled(
|
||||
sarifObjects: util.SarifFile[],
|
||||
features: FeatureEnablement,
|
||||
githubVersion: GitHubVersion,
|
||||
) {
|
||||
if (
|
||||
!(await shouldDisableCombineSarifFiles(
|
||||
sarifObjects,
|
||||
features,
|
||||
githubVersion,
|
||||
))
|
||||
) {
|
||||
if (!(await shouldDisableCombineSarifFiles(sarifObjects, githubVersion))) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -170,7 +163,6 @@ export async function throwIfCombineSarifFilesDisabled(
|
||||
// Checks whether combining SARIF files should be disabled.
|
||||
async function shouldDisableCombineSarifFiles(
|
||||
sarifObjects: util.SarifFile[],
|
||||
features: FeatureEnablement,
|
||||
githubVersion: GitHubVersion,
|
||||
) {
|
||||
if (githubVersion.type === GitHubVariant.GHES) {
|
||||
@@ -178,11 +170,6 @@ async function shouldDisableCombineSarifFiles(
|
||||
if (satisfiesGHESVersion(githubVersion.version, "<3.18", true)) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
// Never block when the feature flag is disabled.
|
||||
if (!(await features.getValue(Feature.DisableCombineSarifFiles))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (areAllRunsUnique(sarifObjects)) {
|
||||
@@ -219,11 +206,7 @@ async function combineSarifFilesUsingCLI(
|
||||
"For more information, see https://github.blog/changelog/2024-05-06-code-scanning-will-stop-combining-runs-from-a-single-upload";
|
||||
|
||||
if (!areAllRunsProducedByCodeQL(sarifObjects)) {
|
||||
await throwIfCombineSarifFilesDisabled(
|
||||
sarifObjects,
|
||||
features,
|
||||
gitHubVersion,
|
||||
);
|
||||
await throwIfCombineSarifFilesDisabled(sarifObjects, gitHubVersion);
|
||||
|
||||
logger.debug(
|
||||
"Not all SARIF files were produced by CodeQL. Merging files in the action.",
|
||||
@@ -290,11 +273,7 @@ async function combineSarifFilesUsingCLI(
|
||||
ToolsFeature.SarifMergeRunsFromEqualCategory,
|
||||
))
|
||||
) {
|
||||
await throwIfCombineSarifFilesDisabled(
|
||||
sarifObjects,
|
||||
features,
|
||||
gitHubVersion,
|
||||
);
|
||||
await throwIfCombineSarifFilesDisabled(sarifObjects, gitHubVersion);
|
||||
|
||||
logger.warning(
|
||||
"The CodeQL CLI does not support merging SARIF files. Merging files in the action.",
|
||||
@@ -727,7 +706,7 @@ export async function uploadSpecifiedFiles(
|
||||
validateSarifFileSchema(sarif, sarifPath, logger);
|
||||
|
||||
// Validate that there are no runs for the same category
|
||||
await throwIfCombineSarifFilesDisabled([sarif], features, gitHubVersion);
|
||||
await throwIfCombineSarifFilesDisabled([sarif], gitHubVersion);
|
||||
}
|
||||
|
||||
sarif = filterAlertsByDiffRange(logger, sarif);
|
||||
|
||||
Reference in New Issue
Block a user