mirror of
https://github.com/github/codeql-action.git
synced 2026-10-21 02:01:27 +00:00
Remove overlay version matching dry run
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
35
lib/entry-points.js
generated
35
lib/entry-points.js
generated
@@ -172089,11 +172089,6 @@ var featureConfig = {
|
||||
envVar: "CODEQL_ACTION_OVERLAY_ANALYSIS_MATCH_CODEQL_VERSION",
|
||||
minimumVersion: void 0
|
||||
},
|
||||
["overlay_analysis_match_codeql_version_dry_run" /* OverlayAnalysisMatchCodeqlVersionDryRun */]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_OVERLAY_ANALYSIS_MATCH_CODEQL_VERSION_DRY_RUN",
|
||||
minimumVersion: void 0
|
||||
},
|
||||
["overlay_analysis_min_disk_8_gb" /* OverlayAnalysisMinDisk8Gb */]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_OVERLAY_ANALYSIS_MIN_DISK_8_GB",
|
||||
@@ -176287,11 +176282,7 @@ async function getEnabledVersionsWithOverlayBaseDatabases(defaultCliVersion, raw
|
||||
if (rawLanguages === void 0 || rawLanguages.length === 0) {
|
||||
return [];
|
||||
}
|
||||
const isEnabled = await features.getValue(
|
||||
"overlay_analysis_match_codeql_version" /* OverlayAnalysisMatchCodeqlVersion */
|
||||
);
|
||||
const isDryRun = !isEnabled && await features.getValue("overlay_analysis_match_codeql_version_dry_run" /* OverlayAnalysisMatchCodeqlVersionDryRun */);
|
||||
if (!isEnabled && !isDryRun) {
|
||||
if (!await features.getValue("overlay_analysis_match_codeql_version" /* OverlayAnalysisMatchCodeqlVersion */)) {
|
||||
return [];
|
||||
}
|
||||
let cachedVersions;
|
||||
@@ -176316,30 +176307,6 @@ async function getEnabledVersionsWithOverlayBaseDatabases(defaultCliVersion, raw
|
||||
if (overlayVersions.length === 0) {
|
||||
return [];
|
||||
}
|
||||
const isCachedVersionDifferent = overlayVersions[0].cliVersion !== defaultCliVersion.enabledVersions[0].cliVersion;
|
||||
if (isCachedVersionDifferent) {
|
||||
addNoLanguageDiagnostic(
|
||||
void 0,
|
||||
makeTelemetryDiagnostic(
|
||||
"codeql-action/overlay-aware-default-codeql-version",
|
||||
"Overlay-aware default CodeQL version selection",
|
||||
{
|
||||
cachedVersions,
|
||||
enabledVersions: defaultCliVersion.enabledVersions.map(
|
||||
(v) => v.cliVersion
|
||||
),
|
||||
isDryRun,
|
||||
overlayAwareVersion: overlayVersions[0].cliVersion
|
||||
}
|
||||
)
|
||||
);
|
||||
}
|
||||
if (isDryRun) {
|
||||
logger2.debug(
|
||||
`Overlay-aware default CodeQL version selection is running in dry-run mode. Would have used version ${overlayVersions[0].cliVersion}.`
|
||||
);
|
||||
return [];
|
||||
}
|
||||
return overlayVersions;
|
||||
}
|
||||
async function resolveDefaultCliVersion(defaultCliVersion, rawLanguages, useOverlayAwareDefaultCliVersion, features, logger2) {
|
||||
|
||||
@@ -120,12 +120,6 @@ export enum Feature {
|
||||
* database exists in the cache.
|
||||
*/
|
||||
OverlayAnalysisMatchCodeqlVersion = "overlay_analysis_match_codeql_version",
|
||||
/**
|
||||
* Like `OverlayAnalysisMatchCodeqlVersion`, but only logs a diagnostic with the version that
|
||||
* would have been chosen instead of actually changing the default CodeQL CLI version.
|
||||
* `OverlayAnalysisMatchCodeqlVersion` overrides this flag.
|
||||
*/
|
||||
OverlayAnalysisMatchCodeqlVersionDryRun = "overlay_analysis_match_codeql_version_dry_run",
|
||||
/**
|
||||
* Lowers the overlay minimum available disk space to 8 GB. The lowest enabled limit wins; if
|
||||
* none are enabled, the default applies.
|
||||
@@ -389,11 +383,6 @@ export const featureConfig = {
|
||||
envVar: "CODEQL_ACTION_OVERLAY_ANALYSIS_MATCH_CODEQL_VERSION",
|
||||
minimumVersion: undefined,
|
||||
},
|
||||
[Feature.OverlayAnalysisMatchCodeqlVersionDryRun]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_OVERLAY_ANALYSIS_MATCH_CODEQL_VERSION_DRY_RUN",
|
||||
minimumVersion: undefined,
|
||||
},
|
||||
[Feature.OverlayAnalysisMinDisk8Gb]: {
|
||||
defaultValue: false,
|
||||
envVar: "CODEQL_ACTION_OVERLAY_ANALYSIS_MIN_DISK_8_GB",
|
||||
|
||||
@@ -1727,7 +1727,7 @@ test.serial(
|
||||
);
|
||||
|
||||
test.serial(
|
||||
"getEnabledVersionsWithOverlayBaseDatabases does not list caches when both gates are off",
|
||||
"getEnabledVersionsWithOverlayBaseDatabases does not list caches when the gate is off",
|
||||
async (t) => {
|
||||
const listStub = sinon.stub(api, "listActionsCaches").resolves([]);
|
||||
|
||||
@@ -1740,64 +1740,11 @@ test.serial(
|
||||
t.deepEqual(result, []);
|
||||
t.assert(
|
||||
listStub.notCalled,
|
||||
"Should not list Actions caches when both gating feature flags are off.",
|
||||
"Should not list Actions caches when the gating feature flag is off.",
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
test.serial(
|
||||
"getEnabledVersionsWithOverlayBaseDatabases dry-run returns empty but lists caches",
|
||||
async (t) => {
|
||||
sinon.stub(api, "getAutomationID").resolves("test/");
|
||||
const listStub = sinon.stub(api, "listActionsCaches").resolves([
|
||||
{
|
||||
key: await fakeOverlayBaseCacheKey("javascript", "2.20.1", "abc-1-1"),
|
||||
},
|
||||
]);
|
||||
|
||||
const result = await setupCodeql.getEnabledVersionsWithOverlayBaseDatabases(
|
||||
overlayMatchEnabledVersions,
|
||||
["javascript"],
|
||||
createFeatures([Feature.OverlayAnalysisMatchCodeqlVersionDryRun]),
|
||||
getRunnerLogger(true),
|
||||
);
|
||||
t.deepEqual(
|
||||
result,
|
||||
[],
|
||||
"Dry-run should return an empty list so the caller falls back.",
|
||||
);
|
||||
t.assert(
|
||||
listStub.calledOnce,
|
||||
"Dry-run should still list Actions caches to populate the diagnostic.",
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
test.serial(
|
||||
"getEnabledVersionsWithOverlayBaseDatabases match flag wins over dry-run",
|
||||
async (t) => {
|
||||
sinon.stub(api, "getAutomationID").resolves("test/");
|
||||
sinon.stub(api, "listActionsCaches").resolves([
|
||||
{
|
||||
key: await fakeOverlayBaseCacheKey("javascript", "2.20.1", "abc-1-1"),
|
||||
},
|
||||
]);
|
||||
|
||||
const result = await setupCodeql.getEnabledVersionsWithOverlayBaseDatabases(
|
||||
overlayMatchEnabledVersions,
|
||||
["javascript"],
|
||||
createFeatures([
|
||||
Feature.OverlayAnalysisMatchCodeqlVersion,
|
||||
Feature.OverlayAnalysisMatchCodeqlVersionDryRun,
|
||||
]),
|
||||
getRunnerLogger(true),
|
||||
);
|
||||
t.deepEqual(result, [
|
||||
{ cliVersion: "2.20.1", tagName: "codeql-bundle-v2.20.1" },
|
||||
]);
|
||||
},
|
||||
);
|
||||
|
||||
/** The CLI version that the toolcache cleanup tests download. */
|
||||
const CLEANUP_CLI_VERSION = "2.21.0";
|
||||
/** The bundle version that the toolcache cleanup tests download. */
|
||||
|
||||
@@ -183,10 +183,8 @@ async function findOverridingToolsInCache(
|
||||
|
||||
/**
|
||||
* Returns the sorted set of enabled versions that have cached overlay-base databases for the
|
||||
* given languages, or an empty list if neither the `OverlayAnalysisMatchCodeqlVersion` nor the
|
||||
* `OverlayAnalysisMatchCodeqlVersionDryRun` feature flag is enabled. When only the dry-run flag
|
||||
* is enabled, this performs the lookup and emits a telemetry diagnostic with the version that
|
||||
* would have been chosen, but still returns an empty list so the caller falls back.
|
||||
* given languages, or an empty list if the `OverlayAnalysisMatchCodeqlVersion` feature flag is
|
||||
* disabled.
|
||||
*/
|
||||
export async function getEnabledVersionsWithOverlayBaseDatabases(
|
||||
defaultCliVersion: CodeQLDefaultVersionInfo,
|
||||
@@ -197,13 +195,7 @@ export async function getEnabledVersionsWithOverlayBaseDatabases(
|
||||
if (rawLanguages === undefined || rawLanguages.length === 0) {
|
||||
return [];
|
||||
}
|
||||
const isEnabled = await features.getValue(
|
||||
Feature.OverlayAnalysisMatchCodeqlVersion,
|
||||
);
|
||||
const isDryRun =
|
||||
!isEnabled &&
|
||||
(await features.getValue(Feature.OverlayAnalysisMatchCodeqlVersionDryRun));
|
||||
if (!isEnabled && !isDryRun) {
|
||||
if (!(await features.getValue(Feature.OverlayAnalysisMatchCodeqlVersion))) {
|
||||
return [];
|
||||
}
|
||||
|
||||
@@ -234,35 +226,6 @@ export async function getEnabledVersionsWithOverlayBaseDatabases(
|
||||
return [];
|
||||
}
|
||||
|
||||
const isCachedVersionDifferent =
|
||||
overlayVersions[0].cliVersion !==
|
||||
defaultCliVersion.enabledVersions[0].cliVersion;
|
||||
|
||||
if (isCachedVersionDifferent) {
|
||||
addNoLanguageDiagnostic(
|
||||
undefined,
|
||||
makeTelemetryDiagnostic(
|
||||
"codeql-action/overlay-aware-default-codeql-version",
|
||||
"Overlay-aware default CodeQL version selection",
|
||||
{
|
||||
cachedVersions,
|
||||
enabledVersions: defaultCliVersion.enabledVersions.map(
|
||||
(v) => v.cliVersion,
|
||||
),
|
||||
isDryRun,
|
||||
overlayAwareVersion: overlayVersions[0].cliVersion,
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
if (isDryRun) {
|
||||
logger.debug(
|
||||
`Overlay-aware default CodeQL version selection is running in dry-run mode. Would have used version ${overlayVersions[0].cliVersion}.`,
|
||||
);
|
||||
return [];
|
||||
}
|
||||
|
||||
return overlayVersions;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user