Resolve dependency cycle between util and API client

This commit is contained in:
Henry Mercer
2023-07-19 16:40:31 +01:00
parent 9922e17dbb
commit d577d6f6b1
24 changed files with 262 additions and 242 deletions

15
lib/feature-flags.js generated
View File

@@ -23,16 +23,23 @@ var __importStar = (this && this.__importStar) || function (mod) {
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.logCodeScanningConfigInCli = exports.useCodeScanningConfigInCli = exports.Features = exports.FEATURE_FLAGS_FILE_NAME = exports.featureConfig = exports.Feature = void 0;
exports.logCodeScanningConfigInCli = exports.useCodeScanningConfigInCli = exports.Features = exports.FEATURE_FLAGS_FILE_NAME = exports.featureConfig = exports.Feature = exports.CODEQL_VERSION_NEW_ANALYSIS_SUMMARY = exports.CODEQL_VERSION_BUNDLE_SEMANTICALLY_VERSIONED = void 0;
const fs = __importStar(require("fs"));
const path = __importStar(require("path"));
const semver = __importStar(require("semver"));
const api_client_1 = require("./api-client");
const codeql_1 = require("./codeql");
const defaults = __importStar(require("./defaults.json"));
const util = __importStar(require("./util"));
const DEFAULT_VERSION_FEATURE_FLAG_PREFIX = "default_codeql_version_";
const DEFAULT_VERSION_FEATURE_FLAG_SUFFIX = "_enabled";
/**
* Versions 2.13.4+ of the CodeQL CLI have an associated CodeQL Bundle release that is semantically versioned.
*/
exports.CODEQL_VERSION_BUNDLE_SEMANTICALLY_VERSIONED = "2.13.4";
/**
* Versions 2.14.0+ of the CodeQL CLI support new analysis summaries.
*/
exports.CODEQL_VERSION_NEW_ANALYSIS_SUMMARY = "2.14.0";
/**
* Feature enablement as returned by the GitHub API endpoint.
*
@@ -73,7 +80,7 @@ exports.featureConfig = {
},
[Feature.NewAnalysisSummaryEnabled]: {
envVar: "CODEQL_ACTION_NEW_ANALYSIS_SUMMARY",
minimumVersion: codeql_1.CODEQL_VERSION_NEW_ANALYSIS_SUMMARY,
minimumVersion: exports.CODEQL_VERSION_NEW_ANALYSIS_SUMMARY,
defaultValue: false,
},
[Feature.QaTelemetryEnabled]: {
@@ -205,7 +212,7 @@ class GitHubFeatureFlags {
.map(([f, isEnabled]) => isEnabled ? this.getCliVersionFromFeatureFlag(f) : undefined)
.filter((f) => f !== undefined &&
// Only consider versions that have semantically versioned bundles.
semver.gte(f, codeql_1.CODEQL_VERSION_BUNDLE_SEMANTICALLY_VERSIONED))
semver.gte(f, exports.CODEQL_VERSION_BUNDLE_SEMANTICALLY_VERSIONED))
.map((f) => f);
if (enabledFeatureFlagCliVersions.length === 0) {
// We expect at least one default CLI version to be enabled on Dotcom at any time. However if