mirror of
https://github.com/github/codeql-action.git
synced 2026-04-25 16:28:48 +00:00
Remove disable_combine_sarif_files feature flag
This commit is contained in:
@@ -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",
|
||||
|
||||
+2
-26
@@ -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,
|
||||
},
|
||||
|
||||
+5
-26
@@ -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