mirror of
https://github.com/github/codeql-action.git
synced 2026-04-02 09:42:16 +00:00
Put change behind a FF
This commit is contained in:
5
lib/analyze-action-post.js
generated
5
lib/analyze-action-post.js
generated
@@ -161755,6 +161755,11 @@ var featureConfig = {
|
||||
// cannot be found when interpreting results.
|
||||
minimumVersion: void 0
|
||||
},
|
||||
["start_proxy_use_features_release" /* StartProxyUseFeaturesRelease */]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_START_PROXY_USE_FEATURES_RELEASE",
|
||||
minimumVersion: void 0
|
||||
},
|
||||
["upload_overlay_db_to_api" /* UploadOverlayDbToApi */]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_UPLOAD_OVERLAY_DB_TO_API",
|
||||
|
||||
5
lib/analyze-action.js
generated
5
lib/analyze-action.js
generated
@@ -107853,6 +107853,11 @@ var featureConfig = {
|
||||
// cannot be found when interpreting results.
|
||||
minimumVersion: void 0
|
||||
},
|
||||
["start_proxy_use_features_release" /* StartProxyUseFeaturesRelease */]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_START_PROXY_USE_FEATURES_RELEASE",
|
||||
minimumVersion: void 0
|
||||
},
|
||||
["upload_overlay_db_to_api" /* UploadOverlayDbToApi */]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_UPLOAD_OVERLAY_DB_TO_API",
|
||||
|
||||
5
lib/autobuild-action.js
generated
5
lib/autobuild-action.js
generated
@@ -104142,6 +104142,11 @@ var featureConfig = {
|
||||
// cannot be found when interpreting results.
|
||||
minimumVersion: void 0
|
||||
},
|
||||
["start_proxy_use_features_release" /* StartProxyUseFeaturesRelease */]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_START_PROXY_USE_FEATURES_RELEASE",
|
||||
minimumVersion: void 0
|
||||
},
|
||||
["upload_overlay_db_to_api" /* UploadOverlayDbToApi */]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_UPLOAD_OVERLAY_DB_TO_API",
|
||||
|
||||
5
lib/init-action-post.js
generated
5
lib/init-action-post.js
generated
@@ -165252,6 +165252,11 @@ var featureConfig = {
|
||||
// cannot be found when interpreting results.
|
||||
minimumVersion: void 0
|
||||
},
|
||||
["start_proxy_use_features_release" /* StartProxyUseFeaturesRelease */]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_START_PROXY_USE_FEATURES_RELEASE",
|
||||
minimumVersion: void 0
|
||||
},
|
||||
["upload_overlay_db_to_api" /* UploadOverlayDbToApi */]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_UPLOAD_OVERLAY_DB_TO_API",
|
||||
|
||||
5
lib/init-action.js
generated
5
lib/init-action.js
generated
@@ -105371,6 +105371,11 @@ var featureConfig = {
|
||||
// cannot be found when interpreting results.
|
||||
minimumVersion: void 0
|
||||
},
|
||||
["start_proxy_use_features_release" /* StartProxyUseFeaturesRelease */]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_START_PROXY_USE_FEATURES_RELEASE",
|
||||
minimumVersion: void 0
|
||||
},
|
||||
["upload_overlay_db_to_api" /* UploadOverlayDbToApi */]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_UPLOAD_OVERLAY_DB_TO_API",
|
||||
|
||||
5
lib/resolve-environment-action.js
generated
5
lib/resolve-environment-action.js
generated
@@ -104133,6 +104133,11 @@ var featureConfig = {
|
||||
// cannot be found when interpreting results.
|
||||
minimumVersion: void 0
|
||||
},
|
||||
["start_proxy_use_features_release" /* StartProxyUseFeaturesRelease */]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_START_PROXY_USE_FEATURES_RELEASE",
|
||||
minimumVersion: void 0
|
||||
},
|
||||
["upload_overlay_db_to_api" /* UploadOverlayDbToApi */]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_UPLOAD_OVERLAY_DB_TO_API",
|
||||
|
||||
5
lib/setup-codeql-action.js
generated
5
lib/setup-codeql-action.js
generated
@@ -104042,6 +104042,11 @@ var featureConfig = {
|
||||
// cannot be found when interpreting results.
|
||||
minimumVersion: void 0
|
||||
},
|
||||
["start_proxy_use_features_release" /* StartProxyUseFeaturesRelease */]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_START_PROXY_USE_FEATURES_RELEASE",
|
||||
minimumVersion: void 0
|
||||
},
|
||||
["upload_overlay_db_to_api" /* UploadOverlayDbToApi */]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_UPLOAD_OVERLAY_DB_TO_API",
|
||||
|
||||
5
lib/start-proxy-action-post.js
generated
5
lib/start-proxy-action-post.js
generated
@@ -161161,6 +161161,11 @@ var featureConfig = {
|
||||
// cannot be found when interpreting results.
|
||||
minimumVersion: void 0
|
||||
},
|
||||
["start_proxy_use_features_release" /* StartProxyUseFeaturesRelease */]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_START_PROXY_USE_FEATURES_RELEASE",
|
||||
minimumVersion: void 0
|
||||
},
|
||||
["upload_overlay_db_to_api" /* UploadOverlayDbToApi */]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_UPLOAD_OVERLAY_DB_TO_API",
|
||||
|
||||
18
lib/start-proxy-action.js
generated
18
lib/start-proxy-action.js
generated
@@ -120834,6 +120834,11 @@ var featureConfig = {
|
||||
// cannot be found when interpreting results.
|
||||
minimumVersion: void 0
|
||||
},
|
||||
["start_proxy_use_features_release" /* StartProxyUseFeaturesRelease */]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_START_PROXY_USE_FEATURES_RELEASE",
|
||||
minimumVersion: void 0
|
||||
},
|
||||
["upload_overlay_db_to_api" /* UploadOverlayDbToApi */]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_UPLOAD_OVERLAY_DB_TO_API",
|
||||
@@ -121706,11 +121711,20 @@ async function getReleaseByVersion(version) {
|
||||
tag: version
|
||||
});
|
||||
}
|
||||
async function getCliVersionFromFeatures(features) {
|
||||
const gitHubVersion = await getGitHubVersion();
|
||||
return await features.getDefaultCliVersion(gitHubVersion.type);
|
||||
}
|
||||
async function getDownloadUrl(logger, features) {
|
||||
const proxyPackage = getProxyPackage();
|
||||
try {
|
||||
const gitHubVersion = await getGitHubVersion();
|
||||
const versionInfo = await features.getDefaultCliVersion(gitHubVersion.type);
|
||||
const useFeaturesToDetermineCLI = await features.getValue(
|
||||
"start_proxy_use_features_release" /* StartProxyUseFeaturesRelease */
|
||||
);
|
||||
const versionInfo = useFeaturesToDetermineCLI ? await getCliVersionFromFeatures(features) : {
|
||||
cliVersion,
|
||||
tagName: bundleVersion
|
||||
};
|
||||
const cliRelease = await getReleaseByVersion(versionInfo.tagName);
|
||||
for (const asset of cliRelease.data.assets) {
|
||||
if (asset.name === proxyPackage) {
|
||||
|
||||
5
lib/upload-lib.js
generated
5
lib/upload-lib.js
generated
@@ -107301,6 +107301,11 @@ var featureConfig = {
|
||||
// cannot be found when interpreting results.
|
||||
minimumVersion: void 0
|
||||
},
|
||||
["start_proxy_use_features_release" /* StartProxyUseFeaturesRelease */]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_START_PROXY_USE_FEATURES_RELEASE",
|
||||
minimumVersion: void 0
|
||||
},
|
||||
["upload_overlay_db_to_api" /* UploadOverlayDbToApi */]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_UPLOAD_OVERLAY_DB_TO_API",
|
||||
|
||||
5
lib/upload-sarif-action-post.js
generated
5
lib/upload-sarif-action-post.js
generated
@@ -161323,6 +161323,11 @@ var featureConfig = {
|
||||
// cannot be found when interpreting results.
|
||||
minimumVersion: void 0
|
||||
},
|
||||
["start_proxy_use_features_release" /* StartProxyUseFeaturesRelease */]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_START_PROXY_USE_FEATURES_RELEASE",
|
||||
minimumVersion: void 0
|
||||
},
|
||||
["upload_overlay_db_to_api" /* UploadOverlayDbToApi */]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_UPLOAD_OVERLAY_DB_TO_API",
|
||||
|
||||
5
lib/upload-sarif-action.js
generated
5
lib/upload-sarif-action.js
generated
@@ -107026,6 +107026,11 @@ var featureConfig = {
|
||||
// cannot be found when interpreting results.
|
||||
minimumVersion: void 0
|
||||
},
|
||||
["start_proxy_use_features_release" /* StartProxyUseFeaturesRelease */]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_START_PROXY_USE_FEATURES_RELEASE",
|
||||
minimumVersion: void 0
|
||||
},
|
||||
["upload_overlay_db_to_api" /* UploadOverlayDbToApi */]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_UPLOAD_OVERLAY_DB_TO_API",
|
||||
|
||||
@@ -77,6 +77,7 @@ export enum Feature {
|
||||
QaTelemetryEnabled = "qa_telemetry_enabled",
|
||||
/** Note that this currently only disables baseline file coverage information. */
|
||||
SkipFileCoverageOnPrs = "skip_file_coverage_on_prs",
|
||||
StartProxyUseFeaturesRelease = "start_proxy_use_features_release",
|
||||
UploadOverlayDbToApi = "upload_overlay_db_to_api",
|
||||
UseRepositoryProperties = "use_repository_properties_v2",
|
||||
ValidateDbConfig = "validate_db_config",
|
||||
@@ -327,6 +328,11 @@ export const featureConfig = {
|
||||
// cannot be found when interpreting results.
|
||||
minimumVersion: undefined,
|
||||
},
|
||||
[Feature.StartProxyUseFeaturesRelease]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_START_PROXY_USE_FEATURES_RELEASE",
|
||||
minimumVersion: undefined,
|
||||
},
|
||||
[Feature.UploadOverlayDbToApi]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_UPLOAD_OVERLAY_DB_TO_API",
|
||||
|
||||
@@ -15,6 +15,7 @@ import { parseLanguage } from "./start-proxy";
|
||||
import * as statusReport from "./status-report";
|
||||
import {
|
||||
checkExpectedLogMessages,
|
||||
createFeatures,
|
||||
getRecordingLogger,
|
||||
makeTestToken,
|
||||
RecordingLogger,
|
||||
@@ -621,6 +622,52 @@ test("getProxyBinaryPath - returns path from tool cache if available", async (t)
|
||||
});
|
||||
|
||||
test("getProxyBinaryPath - downloads proxy if not in cache", async (t) => {
|
||||
const downloadUrl = "url-we-want";
|
||||
mockGetReleaseByTag([
|
||||
{ name: startProxyExports.getProxyPackage(), url: downloadUrl },
|
||||
]);
|
||||
|
||||
await withRecordingLoggerAsync(async (logger) => {
|
||||
const toolcachePath = "/path/to/proxy/dir";
|
||||
const find = sinon.stub(toolcache, "find").returns("");
|
||||
const getApiDetails = sinon.stub(apiClient, "getApiDetails").returns({
|
||||
auth: "",
|
||||
url: "",
|
||||
apiURL: "",
|
||||
});
|
||||
const getAuthorizationHeaderFor = sinon
|
||||
.stub(apiClient, "getAuthorizationHeaderFor")
|
||||
.returns(undefined);
|
||||
const archivePath = "/path/to/archive";
|
||||
const downloadTool = sinon
|
||||
.stub(toolcache, "downloadTool")
|
||||
.resolves(archivePath);
|
||||
const extractedPath = "/path/to/extracted";
|
||||
const extractTar = sinon
|
||||
.stub(toolcache, "extractTar")
|
||||
.resolves(extractedPath);
|
||||
const cacheDir = sinon.stub(toolcache, "cacheDir").resolves(toolcachePath);
|
||||
|
||||
const path = await startProxyExports.getProxyBinaryPath(
|
||||
logger,
|
||||
createFeatures([]),
|
||||
);
|
||||
|
||||
t.assert(find.calledOnce);
|
||||
t.assert(getApiDetails.calledOnce);
|
||||
t.assert(getAuthorizationHeaderFor.calledOnce);
|
||||
t.assert(downloadTool.calledOnceWith(downloadUrl));
|
||||
t.assert(extractTar.calledOnceWith(archivePath));
|
||||
t.assert(cacheDir.calledOnceWith(extractedPath));
|
||||
t.assert(path);
|
||||
t.is(
|
||||
path,
|
||||
filepath.join(toolcachePath, startProxyExports.getProxyFilename()),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
test("getProxyBinaryPath - downloads proxy based on features if not in cache", async (t) => {
|
||||
const logger = new RecordingLogger();
|
||||
const expectedTag = "codeql-bundle-v2.20.1";
|
||||
const expectedParams = {
|
||||
@@ -672,6 +719,9 @@ test("getProxyBinaryPath - downloads proxy if not in cache", async (t) => {
|
||||
sinon.stub(apiClient, "getGitHubVersion").resolves(gitHubVersion);
|
||||
|
||||
const features = setUpFeatureFlagTests(tempDir, logger, gitHubVersion);
|
||||
sinon.stub(features, "getValue").callsFake(async (_feature, _codeql) => {
|
||||
return true;
|
||||
});
|
||||
const getDefaultCliVersion = sinon
|
||||
.stub(features, "getDefaultCliVersion")
|
||||
.resolves({ cliVersion: "2.20.1", tagName: expectedTag });
|
||||
|
||||
@@ -12,7 +12,11 @@ import {
|
||||
import * as artifactScanner from "./artifact-scanner";
|
||||
import { Config } from "./config-utils";
|
||||
import * as defaults from "./defaults.json";
|
||||
import { FeatureEnablement } from "./feature-flags";
|
||||
import {
|
||||
CodeQLDefaultVersionInfo,
|
||||
Feature,
|
||||
FeatureEnablement,
|
||||
} from "./feature-flags";
|
||||
import { KnownLanguage } from "./languages";
|
||||
import { Logger } from "./logging";
|
||||
import {
|
||||
@@ -405,6 +409,14 @@ async function getReleaseByVersion(version: string) {
|
||||
});
|
||||
}
|
||||
|
||||
/** Uses `features` to determine the default CLI version. */
|
||||
async function getCliVersionFromFeatures(
|
||||
features: FeatureEnablement,
|
||||
): Promise<CodeQLDefaultVersionInfo> {
|
||||
const gitHubVersion = await getGitHubVersion();
|
||||
return await features.getDefaultCliVersion(gitHubVersion.type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines the URL of the proxy release asset that we should download if its not
|
||||
* already in the toolcache, and its version.
|
||||
@@ -420,10 +432,18 @@ export async function getDownloadUrl(
|
||||
const proxyPackage = getProxyPackage();
|
||||
|
||||
try {
|
||||
const useFeaturesToDetermineCLI = await features.getValue(
|
||||
Feature.StartProxyUseFeaturesRelease,
|
||||
);
|
||||
|
||||
// Retrieve information about the CLI version we should use. This will be either the linked
|
||||
// version, or the one enabled by FFs.
|
||||
const gitHubVersion = await getGitHubVersion();
|
||||
const versionInfo = await features.getDefaultCliVersion(gitHubVersion.type);
|
||||
const versionInfo = useFeaturesToDetermineCLI
|
||||
? await getCliVersionFromFeatures(features)
|
||||
: {
|
||||
cliVersion: defaults.cliVersion,
|
||||
tagName: defaults.bundleVersion,
|
||||
};
|
||||
|
||||
// Try to retrieve information about the CLI bundle release identified by `versionInfo`.
|
||||
const cliRelease = await getReleaseByVersion(versionInfo.tagName);
|
||||
|
||||
Reference in New Issue
Block a user