Fix name of Python stdlib extraction feature flag
This commit is contained in:
parent
c4700633cb
commit
d591d172c8
9 changed files with 43 additions and 19 deletions
17
lib/feature-flags.js
generated
17
lib/feature-flags.js
generated
|
|
@ -45,18 +45,21 @@ exports.CODEQL_VERSION_ZSTD_BUNDLE = "2.19.0";
|
|||
/**
|
||||
* Feature enablement as returned by the GitHub API endpoint.
|
||||
*
|
||||
* Do not include the `codeql_action_` prefix as this is stripped by the API
|
||||
* endpoint.
|
||||
*
|
||||
* Legacy features should end with `_enabled`.
|
||||
*/
|
||||
var Feature;
|
||||
(function (Feature) {
|
||||
Feature["ArtifactV4Upgrade"] = "artifact_v4_upgrade";
|
||||
Feature["CleanupTrapCaches"] = "cleanup_trap_caches";
|
||||
Feature["CodeqlActionPythonDefaultIsToNotExtractStdlib"] = "codeql_action_python_default_is_to_not_extract_stdlib";
|
||||
Feature["CppDependencyInstallation"] = "cpp_dependency_installation_enabled";
|
||||
Feature["DisableCsharpBuildless"] = "disable_csharp_buildless";
|
||||
Feature["DisableJavaBuildlessEnabled"] = "disable_java_buildless_enabled";
|
||||
Feature["DisableKotlinAnalysisEnabled"] = "disable_kotlin_analysis_enabled";
|
||||
Feature["ExportDiagnosticsEnabled"] = "export_diagnostics_enabled";
|
||||
Feature["PythonDefaultIsToNotExtractStdlib"] = "python_default_is_to_not_extract_stdlib";
|
||||
Feature["QaTelemetryEnabled"] = "qa_telemetry_enabled";
|
||||
Feature["ZstdBundle"] = "zstd_bundle";
|
||||
Feature["ZstdBundleStreamingExtraction"] = "zstd_bundle_streaming_extraction";
|
||||
|
|
@ -72,12 +75,6 @@ exports.featureConfig = {
|
|||
envVar: "CODEQL_ACTION_CLEANUP_TRAP_CACHES",
|
||||
minimumVersion: undefined,
|
||||
},
|
||||
[Feature.CodeqlActionPythonDefaultIsToNotExtractStdlib]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_DISABLE_PYTHON_STANDARD_LIBRARY_EXTRACTION",
|
||||
minimumVersion: undefined,
|
||||
toolsFeature: tools_features_1.ToolsFeature.PythonDefaultIsToNotExtractStdlib,
|
||||
},
|
||||
[Feature.CppDependencyInstallation]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES",
|
||||
|
|
@ -107,6 +104,12 @@ exports.featureConfig = {
|
|||
legacyApi: true,
|
||||
minimumVersion: undefined,
|
||||
},
|
||||
[Feature.PythonDefaultIsToNotExtractStdlib]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_DISABLE_PYTHON_STANDARD_LIBRARY_EXTRACTION",
|
||||
minimumVersion: undefined,
|
||||
toolsFeature: tools_features_1.ToolsFeature.PythonDefaultIsToNotExtractStdlib,
|
||||
},
|
||||
[Feature.QaTelemetryEnabled]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_QA_TELEMETRY",
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
7
lib/feature-flags.test.js
generated
7
lib/feature-flags.test.js
generated
|
|
@ -318,6 +318,13 @@ for (const feature of Object.keys(feature_flags_1.featureConfig)) {
|
|||
}
|
||||
}
|
||||
});
|
||||
(0, ava_1.default)("non-legacy feature flags should not start with codeql_action_", async (t) => {
|
||||
for (const [feature, config] of Object.entries(feature_flags_1.featureConfig)) {
|
||||
if (!config.legacyApi) {
|
||||
t.false(feature.startsWith("codeql_action_"), `non-legacy feature ${feature} should not start with 'codeql_action_'`);
|
||||
}
|
||||
}
|
||||
});
|
||||
function assertAllFeaturesUndefinedInApi(t, loggedMessages) {
|
||||
for (const feature of Object.keys(feature_flags_1.featureConfig)) {
|
||||
t.assert(loggedMessages.find((v) => v.type === "debug" &&
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
2
lib/init-action.js
generated
2
lib/init-action.js
generated
|
|
@ -344,7 +344,7 @@ async function run() {
|
|||
}
|
||||
if (await codeql.supportsFeature(tools_features_1.ToolsFeature.PythonDefaultIsToNotExtractStdlib)) {
|
||||
// We are in the case where the default has switched to not extracting the stdlib.
|
||||
if (!(await features.getValue(feature_flags_1.Feature.CodeqlActionPythonDefaultIsToNotExtractStdlib, codeql))) {
|
||||
if (!(await features.getValue(feature_flags_1.Feature.PythonDefaultIsToNotExtractStdlib, codeql))) {
|
||||
// We are in a situation where the feature flag is not rolled out,
|
||||
// so we need to suppress the new default behavior.
|
||||
core.exportVariable("CODEQL_EXTRACTOR_PYTHON_EXTRACT_STDLIB", "true");
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -495,6 +495,17 @@ test("non-legacy feature flags should not end with _enabled", async (t) => {
|
|||
}
|
||||
});
|
||||
|
||||
test("non-legacy feature flags should not start with codeql_action_", async (t) => {
|
||||
for (const [feature, config] of Object.entries(featureConfig)) {
|
||||
if (!config.legacyApi) {
|
||||
t.false(
|
||||
feature.startsWith("codeql_action_"),
|
||||
`non-legacy feature ${feature} should not start with 'codeql_action_'`,
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function assertAllFeaturesUndefinedInApi(
|
||||
t: ExecutionContext<unknown>,
|
||||
loggedMessages: LoggedMessage[],
|
||||
|
|
|
|||
|
|
@ -42,17 +42,20 @@ export interface FeatureEnablement {
|
|||
/**
|
||||
* Feature enablement as returned by the GitHub API endpoint.
|
||||
*
|
||||
* Do not include the `codeql_action_` prefix as this is stripped by the API
|
||||
* endpoint.
|
||||
*
|
||||
* Legacy features should end with `_enabled`.
|
||||
*/
|
||||
export enum Feature {
|
||||
ArtifactV4Upgrade = "artifact_v4_upgrade",
|
||||
CleanupTrapCaches = "cleanup_trap_caches",
|
||||
CodeqlActionPythonDefaultIsToNotExtractStdlib = "codeql_action_python_default_is_to_not_extract_stdlib",
|
||||
CppDependencyInstallation = "cpp_dependency_installation_enabled",
|
||||
DisableCsharpBuildless = "disable_csharp_buildless",
|
||||
DisableJavaBuildlessEnabled = "disable_java_buildless_enabled",
|
||||
DisableKotlinAnalysisEnabled = "disable_kotlin_analysis_enabled",
|
||||
ExportDiagnosticsEnabled = "export_diagnostics_enabled",
|
||||
PythonDefaultIsToNotExtractStdlib = "python_default_is_to_not_extract_stdlib",
|
||||
QaTelemetryEnabled = "qa_telemetry_enabled",
|
||||
ZstdBundle = "zstd_bundle",
|
||||
ZstdBundleStreamingExtraction = "zstd_bundle_streaming_extraction",
|
||||
|
|
@ -99,12 +102,6 @@ export const featureConfig: Record<
|
|||
envVar: "CODEQL_ACTION_CLEANUP_TRAP_CACHES",
|
||||
minimumVersion: undefined,
|
||||
},
|
||||
[Feature.CodeqlActionPythonDefaultIsToNotExtractStdlib]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_DISABLE_PYTHON_STANDARD_LIBRARY_EXTRACTION",
|
||||
minimumVersion: undefined,
|
||||
toolsFeature: ToolsFeature.PythonDefaultIsToNotExtractStdlib,
|
||||
},
|
||||
[Feature.CppDependencyInstallation]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES",
|
||||
|
|
@ -134,6 +131,12 @@ export const featureConfig: Record<
|
|||
legacyApi: true,
|
||||
minimumVersion: undefined,
|
||||
},
|
||||
[Feature.PythonDefaultIsToNotExtractStdlib]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_DISABLE_PYTHON_STANDARD_LIBRARY_EXTRACTION",
|
||||
minimumVersion: undefined,
|
||||
toolsFeature: ToolsFeature.PythonDefaultIsToNotExtractStdlib,
|
||||
},
|
||||
[Feature.QaTelemetryEnabled]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_QA_TELEMETRY",
|
||||
|
|
|
|||
|
|
@ -597,7 +597,7 @@ async function run() {
|
|||
// We are in the case where the default has switched to not extracting the stdlib.
|
||||
if (
|
||||
!(await features.getValue(
|
||||
Feature.CodeqlActionPythonDefaultIsToNotExtractStdlib,
|
||||
Feature.PythonDefaultIsToNotExtractStdlib,
|
||||
codeql,
|
||||
))
|
||||
) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue