Skip to content

Commit 8aab3d8

Browse files
authored
Merge pull request #4298 from github/mbg/decouple-features-enum
Move `Feature` enum to a separate file
2 parents 064910b + 29ddace commit 8aab3d8

2 files changed

Lines changed: 103 additions & 101 deletions

File tree

‎src/feature-flags.ts‎

Lines changed: 3 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import * as semver from "semver";
66
import { getApiClient } from "./api-client";
77
import type { CodeQL } from "./codeql";
88
import * as defaults from "./defaults.json";
9+
import { Feature } from "./feature-flags/features";
910
import { Logger } from "./logging";
1011
import {
1112
CODEQL_OVERLAY_MINIMUM_VERSION,
@@ -21,6 +22,8 @@ import { RepositoryNwo } from "./repository";
2122
import { ToolsFeature } from "./tools-features";
2223
import * as util from "./util";
2324

25+
export { Feature } from "./feature-flags/features";
26+
2427
const DEFAULT_VERSION_FEATURE_FLAG_PREFIX = "default_codeql_version_";
2528
const DEFAULT_VERSION_FEATURE_FLAG_SUFFIX = "_enabled";
2629

@@ -61,107 +64,6 @@ export interface CodeQLDefaultVersionInfo {
6164
toolsFeatureFlagsValid?: boolean;
6265
}
6366

64-
/**
65-
* Features as named by the GitHub API endpoint.
66-
*
67-
* Do not include the `codeql_action_` prefix as this is stripped by the API
68-
* endpoint.
69-
*
70-
* Legacy features should end with `_enabled`.
71-
*/
72-
export enum Feature {
73-
/** Allows supported properties of configuration files to be merged. */
74-
AllowMergeConfigFiles = "allow_merge_config_files",
75-
/** Controls whether we allow multiple values for the `analysis-kinds` input. */
76-
AllowMultipleAnalysisKinds = "allow_multiple_analysis_kinds",
77-
/**
78-
* Whether to check for unsupported traced analysis. Primarily intended as an override to disable
79-
* the check if it causes problems somehow.
80-
*/
81-
CheckUnsupportedTracedAnalysis = "check_unsupported_traced_analysis",
82-
/** Whether to allow the `config-file` input to be specified via a repository property. */
83-
ConfigFileRepositoryProperty = "config_file_repository_property",
84-
CppDependencyInstallation = "cpp_dependency_installation_enabled",
85-
CsharpCacheBuildModeNone = "csharp_cache_bmn",
86-
CsharpNewCacheKey = "csharp_new_cache_key",
87-
DiffInformedQueries = "diff_informed_queries",
88-
DisableCsharpBuildless = "disable_csharp_buildless",
89-
DisableJavaBuildlessEnabled = "disable_java_buildless_enabled",
90-
DisableKotlinAnalysisEnabled = "disable_kotlin_analysis_enabled",
91-
ExportDiagnosticsEnabled = "export_diagnostics_enabled",
92-
/**
93-
* Emergency override that forces the CodeQL CLI to use the JGit-based Git backend instead of its
94-
* default backend selection.
95-
*/
96-
ForceJGit = "force_jgit",
97-
ForceNightly = "force_nightly",
98-
IgnoreGeneratedFiles = "ignore_generated_files",
99-
JavaNetworkDebugging = "java_network_debugging",
100-
OverlayAnalysis = "overlay_analysis",
101-
OverlayAnalysisCodeScanningCpp = "overlay_analysis_code_scanning_cpp",
102-
OverlayAnalysisCodeScanningCsharp = "overlay_analysis_code_scanning_csharp",
103-
OverlayAnalysisCodeScanningGo = "overlay_analysis_code_scanning_go",
104-
OverlayAnalysisCodeScanningJava = "overlay_analysis_code_scanning_java",
105-
OverlayAnalysisCodeScanningJavascript = "overlay_analysis_code_scanning_javascript",
106-
OverlayAnalysisCodeScanningPython = "overlay_analysis_code_scanning_python",
107-
OverlayAnalysisCodeScanningRuby = "overlay_analysis_code_scanning_ruby",
108-
OverlayAnalysisCpp = "overlay_analysis_cpp",
109-
OverlayAnalysisCsharp = "overlay_analysis_csharp",
110-
OverlayAnalysisGo = "overlay_analysis_go",
111-
OverlayAnalysisJava = "overlay_analysis_java",
112-
OverlayAnalysisJavascript = "overlay_analysis_javascript",
113-
/**
114-
* Lowers the overlay minimum available disk space to 8 GB. The lowest enabled limit wins; if
115-
* none are enabled, the default applies.
116-
*/
117-
OverlayAnalysisMinDisk8Gb = "overlay_analysis_min_disk_8_gb",
118-
/**
119-
* Lowers the overlay minimum available disk space to 9 GB. The lowest enabled limit wins; if
120-
* none are enabled, the default applies.
121-
*/
122-
OverlayAnalysisMinDisk9Gb = "overlay_analysis_min_disk_9_gb",
123-
/**
124-
* Lowers the overlay minimum available disk space to 10 GB. The lowest enabled limit wins; if
125-
* none are enabled, the default applies.
126-
*/
127-
OverlayAnalysisMinDisk10Gb = "overlay_analysis_min_disk_10_gb",
128-
/**
129-
* Lowers the overlay minimum available disk space to 11 GB. The lowest enabled limit wins; if
130-
* none are enabled, the default applies.
131-
*/
132-
OverlayAnalysisMinDisk11Gb = "overlay_analysis_min_disk_11_gb",
133-
/**
134-
* Lowers the overlay minimum available disk space to 12 GB. The lowest enabled limit wins; if
135-
* none are enabled, the default applies.
136-
*/
137-
OverlayAnalysisMinDisk12Gb = "overlay_analysis_min_disk_12_gb",
138-
/**
139-
* Lowers the overlay minimum available disk space to 13 GB. The lowest enabled limit wins; if
140-
* none are enabled, the default applies.
141-
*/
142-
OverlayAnalysisMinDisk13Gb = "overlay_analysis_min_disk_13_gb",
143-
OverlayAnalysisPython = "overlay_analysis_python",
144-
OverlayAnalysisRuby = "overlay_analysis_ruby",
145-
/** Controls whether hardware checks are skipped for overlay analysis. */
146-
OverlayAnalysisSkipResourceChecks = "overlay_analysis_skip_resource_checks",
147-
/** Controls whether the Actions cache is checked for overlay build outcomes. */
148-
OverlayAnalysisStatusCheck = "overlay_analysis_status_check",
149-
/** Controls whether overlay build failures on the default branch are stored in the Actions cache. */
150-
OverlayAnalysisStatusSave = "overlay_analysis_status_save",
151-
QaTelemetryEnabled = "qa_telemetry_enabled",
152-
/** Whether we should fail early if we detect that traced analysis is unsupported. */
153-
AbortUnsupportedTracedAnalysis = "abort_unsupported_traced_analysis",
154-
/** Routes (some) API requests through the registry proxy. */
155-
ProxyApiRequests = "proxy_api_requests",
156-
/** Note that this currently only disables baseline file coverage information. */
157-
SkipFileCoverageOnPrs = "skip_file_coverage_on_prs",
158-
StartProxyUseFeaturesRelease = "start_proxy_use_features_release",
159-
/** Whether to allow the `tools` input to be specified via a repository property. */
160-
ToolsRepositoryProperty = "tools_repository_property",
161-
UploadOverlayDbToApi = "upload_overlay_db_to_api",
162-
ValidateDbConfig = "validate_db_config",
163-
}
164-
16567
export type FeatureConfig = {
16668
/**
16769
* Default value in environments where the feature flags API is not available,

‎src/feature-flags/features.ts‎

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
/**
2+
* Features as named by the GitHub API endpoint.
3+
*
4+
* Do not include the `codeql_action_` prefix as this is stripped by the API
5+
* endpoint.
6+
*
7+
* Legacy features should end with `_enabled`.
8+
*/
9+
export enum Feature {
10+
/** Allows supported properties of configuration files to be merged. */
11+
AllowMergeConfigFiles = "allow_merge_config_files",
12+
/** Controls whether we allow multiple values for the `analysis-kinds` input. */
13+
AllowMultipleAnalysisKinds = "allow_multiple_analysis_kinds",
14+
/**
15+
* Whether to check for unsupported traced analysis. Primarily intended as an override to disable
16+
* the check if it causes problems somehow.
17+
*/
18+
CheckUnsupportedTracedAnalysis = "check_unsupported_traced_analysis",
19+
/** Whether to allow the `config-file` input to be specified via a repository property. */
20+
ConfigFileRepositoryProperty = "config_file_repository_property",
21+
CppDependencyInstallation = "cpp_dependency_installation_enabled",
22+
CsharpCacheBuildModeNone = "csharp_cache_bmn",
23+
CsharpNewCacheKey = "csharp_new_cache_key",
24+
DiffInformedQueries = "diff_informed_queries",
25+
DisableCsharpBuildless = "disable_csharp_buildless",
26+
DisableJavaBuildlessEnabled = "disable_java_buildless_enabled",
27+
DisableKotlinAnalysisEnabled = "disable_kotlin_analysis_enabled",
28+
ExportDiagnosticsEnabled = "export_diagnostics_enabled",
29+
/**
30+
* Emergency override that forces the CodeQL CLI to use the JGit-based Git backend instead of its
31+
* default backend selection.
32+
*/
33+
ForceJGit = "force_jgit",
34+
ForceNightly = "force_nightly",
35+
IgnoreGeneratedFiles = "ignore_generated_files",
36+
JavaNetworkDebugging = "java_network_debugging",
37+
OverlayAnalysis = "overlay_analysis",
38+
OverlayAnalysisCodeScanningCpp = "overlay_analysis_code_scanning_cpp",
39+
OverlayAnalysisCodeScanningCsharp = "overlay_analysis_code_scanning_csharp",
40+
OverlayAnalysisCodeScanningGo = "overlay_analysis_code_scanning_go",
41+
OverlayAnalysisCodeScanningJava = "overlay_analysis_code_scanning_java",
42+
OverlayAnalysisCodeScanningJavascript = "overlay_analysis_code_scanning_javascript",
43+
OverlayAnalysisCodeScanningPython = "overlay_analysis_code_scanning_python",
44+
OverlayAnalysisCodeScanningRuby = "overlay_analysis_code_scanning_ruby",
45+
OverlayAnalysisCpp = "overlay_analysis_cpp",
46+
OverlayAnalysisCsharp = "overlay_analysis_csharp",
47+
OverlayAnalysisGo = "overlay_analysis_go",
48+
OverlayAnalysisJava = "overlay_analysis_java",
49+
OverlayAnalysisJavascript = "overlay_analysis_javascript",
50+
/**
51+
* Lowers the overlay minimum available disk space to 8 GB. The lowest enabled limit wins; if
52+
* none are enabled, the default applies.
53+
*/
54+
OverlayAnalysisMinDisk8Gb = "overlay_analysis_min_disk_8_gb",
55+
/**
56+
* Lowers the overlay minimum available disk space to 9 GB. The lowest enabled limit wins; if
57+
* none are enabled, the default applies.
58+
*/
59+
OverlayAnalysisMinDisk9Gb = "overlay_analysis_min_disk_9_gb",
60+
/**
61+
* Lowers the overlay minimum available disk space to 10 GB. The lowest enabled limit wins; if
62+
* none are enabled, the default applies.
63+
*/
64+
OverlayAnalysisMinDisk10Gb = "overlay_analysis_min_disk_10_gb",
65+
/**
66+
* Lowers the overlay minimum available disk space to 11 GB. The lowest enabled limit wins; if
67+
* none are enabled, the default applies.
68+
*/
69+
OverlayAnalysisMinDisk11Gb = "overlay_analysis_min_disk_11_gb",
70+
/**
71+
* Lowers the overlay minimum available disk space to 12 GB. The lowest enabled limit wins; if
72+
* none are enabled, the default applies.
73+
*/
74+
OverlayAnalysisMinDisk12Gb = "overlay_analysis_min_disk_12_gb",
75+
/**
76+
* Lowers the overlay minimum available disk space to 13 GB. The lowest enabled limit wins; if
77+
* none are enabled, the default applies.
78+
*/
79+
OverlayAnalysisMinDisk13Gb = "overlay_analysis_min_disk_13_gb",
80+
OverlayAnalysisPython = "overlay_analysis_python",
81+
OverlayAnalysisRuby = "overlay_analysis_ruby",
82+
/** Controls whether hardware checks are skipped for overlay analysis. */
83+
OverlayAnalysisSkipResourceChecks = "overlay_analysis_skip_resource_checks",
84+
/** Controls whether the Actions cache is checked for overlay build outcomes. */
85+
OverlayAnalysisStatusCheck = "overlay_analysis_status_check",
86+
/** Controls whether overlay build failures on the default branch are stored in the Actions cache. */
87+
OverlayAnalysisStatusSave = "overlay_analysis_status_save",
88+
QaTelemetryEnabled = "qa_telemetry_enabled",
89+
/** Whether we should fail early if we detect that traced analysis is unsupported. */
90+
AbortUnsupportedTracedAnalysis = "abort_unsupported_traced_analysis",
91+
/** Routes (some) API requests through the registry proxy. */
92+
ProxyApiRequests = "proxy_api_requests",
93+
/** Note that this currently only disables baseline file coverage information. */
94+
SkipFileCoverageOnPrs = "skip_file_coverage_on_prs",
95+
StartProxyUseFeaturesRelease = "start_proxy_use_features_release",
96+
/** Whether to allow the `tools` input to be specified via a repository property. */
97+
ToolsRepositoryProperty = "tools_repository_property",
98+
UploadOverlayDbToApi = "upload_overlay_db_to_api",
99+
ValidateDbConfig = "validate_db_config",
100+
}

0 commit comments

Comments
 (0)