Remove feature flag for combine SARIF files deprecation warning

This commit is contained in:
Koen Vlaswinkel 2024-05-14 11:00:12 +02:00
parent 08487dbb93
commit 931fabe1ef
9 changed files with 17 additions and 69 deletions

View file

@ -46,7 +46,6 @@ export interface FeatureEnablement {
*/
export enum Feature {
AutobuildDirectTracing = "autobuild_direct_tracing",
CombineSarifFilesDeprecationWarning = "combine_sarif_files_deprecation_warning_enabled",
CppDependencyInstallation = "cpp_dependency_installation_enabled",
CppTrapCachingEnabled = "cpp_trap_caching_enabled",
DisableJavaBuildlessEnabled = "disable_java_buildless_enabled",
@ -92,13 +91,6 @@ export const featureConfig: Record<
minimumVersion: undefined,
toolsFeature: ToolsFeature.TraceCommandUseBuildMode,
},
[Feature.CombineSarifFilesDeprecationWarning]: {
defaultValue: false,
envVar: "CODEQL_ACTION_COMBINE_SARIF_FILES_DEPRECATION_WARNING",
legacyApi: true,
// Independent of the CLI version.
minimumVersion: undefined,
},
[Feature.CppDependencyInstallation]: {
defaultValue: false,
envVar: "CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES",

View file

@ -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";
@ -325,23 +324,10 @@ test("accept results with invalid artifactLocation.uri value", (t) => {
);
});
test("shouldShowCombineSarifFilesDeprecationWarning when on dotcom with feature flag", async (t) => {
test("shouldShowCombineSarifFilesDeprecationWarning when on dotcom", async (t) => {
t.true(
await uploadLib.shouldShowCombineSarifFilesDeprecationWarning(
[createMockSarif("abc", "def"), createMockSarif("abc", "def")],
createFeatures([Feature.CombineSarifFilesDeprecationWarning]),
{
type: GitHubVariant.DOTCOM,
},
),
);
});
test("shouldShowCombineSarifFilesDeprecationWarning without feature flag", async (t) => {
t.false(
await uploadLib.shouldShowCombineSarifFilesDeprecationWarning(
[createMockSarif("abc", "def"), createMockSarif("abc", "def")],
createFeatures([]),
{
type: GitHubVariant.DOTCOM,
},
@ -353,7 +339,6 @@ test("shouldShowCombineSarifFilesDeprecationWarning when on GHES 3.13", async (t
t.false(
await uploadLib.shouldShowCombineSarifFilesDeprecationWarning(
[createMockSarif("abc", "def"), createMockSarif("abc", "def")],
createFeatures([Feature.CombineSarifFilesDeprecationWarning]),
{
type: GitHubVariant.GHES,
version: "3.13.2",
@ -366,7 +351,6 @@ test("shouldShowCombineSarifFilesDeprecationWarning when on GHES 3.14", async (t
t.true(
await uploadLib.shouldShowCombineSarifFilesDeprecationWarning(
[createMockSarif("abc", "def"), createMockSarif("abc", "def")],
createFeatures([Feature.CombineSarifFilesDeprecationWarning]),
{
type: GitHubVariant.GHES,
version: "3.14.0",
@ -379,7 +363,6 @@ test("shouldShowCombineSarifFilesDeprecationWarning with only 1 run", async (t)
t.false(
await uploadLib.shouldShowCombineSarifFilesDeprecationWarning(
[createMockSarif("abc", "def")],
createFeatures([Feature.CombineSarifFilesDeprecationWarning]),
{
type: GitHubVariant.DOTCOM,
},
@ -391,7 +374,6 @@ test("shouldShowCombineSarifFilesDeprecationWarning with distinct categories", a
t.false(
await uploadLib.shouldShowCombineSarifFilesDeprecationWarning(
[createMockSarif("abc", "def"), createMockSarif("def", "def")],
createFeatures([Feature.CombineSarifFilesDeprecationWarning]),
{
type: GitHubVariant.DOTCOM,
},
@ -403,7 +385,6 @@ test("shouldShowCombineSarifFilesDeprecationWarning with distinct tools", async
t.false(
await uploadLib.shouldShowCombineSarifFilesDeprecationWarning(
[createMockSarif("abc", "abc"), createMockSarif("abc", "def")],
createFeatures([Feature.CombineSarifFilesDeprecationWarning]),
{
type: GitHubVariant.DOTCOM,
},
@ -417,7 +398,6 @@ test("shouldShowCombineSarifFilesDeprecationWarning when environment variable is
t.false(
await uploadLib.shouldShowCombineSarifFilesDeprecationWarning(
[createMockSarif("abc", "def"), createMockSarif("abc", "def")],
createFeatures([Feature.CombineSarifFilesDeprecationWarning]),
{
type: GitHubVariant.DOTCOM,
},

View file

@ -15,7 +15,7 @@ import { getGitHubVersion, wrapApiConfigurationError } from "./api-client";
import { CodeQL, getCodeQL } from "./codeql";
import { getConfig } from "./config-utils";
import { EnvVar } from "./environment";
import { Feature, FeatureEnablement, Features } from "./feature-flags";
import { FeatureEnablement, Features } from "./feature-flags";
import * as fingerprints from "./fingerprints";
import { initCodeQL } from "./init";
import { Logger } from "./logging";
@ -125,13 +125,8 @@ function areAllRunsUnique(sarifObjects: SarifFile[]): boolean {
// Checks whether the deprecation warning for combining SARIF files should be shown.
export async function shouldShowCombineSarifFilesDeprecationWarning(
sarifObjects: util.SarifFile[],
features: FeatureEnablement,
githubVersion: GitHubVersion,
) {
if (!(await features.getValue(Feature.CombineSarifFilesDeprecationWarning))) {
return false;
}
// Do not show this warning on GHES versions before 3.14.0
if (
githubVersion.type === GitHubVariant.GHES &&
@ -182,7 +177,6 @@ async function combineSarifFilesUsingCLI(
if (
await shouldShowCombineSarifFilesDeprecationWarning(
sarifObjects,
features,
gitHubVersion,
)
) {
@ -245,7 +239,6 @@ async function combineSarifFilesUsingCLI(
if (
await shouldShowCombineSarifFilesDeprecationWarning(
sarifObjects,
features,
gitHubVersion,
)
) {