Skip to content

Commit 0e72543

Browse files
henrymercerCopilot
andcommitted
Remove overlay version matching dry run
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent 57938b8 commit 0e72543

4 files changed

Lines changed: 6 additions & 140 deletions

File tree

‎lib/entry-points.js‎

Lines changed: 1 addition & 34 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/feature-flags.ts‎

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,6 @@ export enum Feature {
120120
* database exists in the cache.
121121
*/
122122
OverlayAnalysisMatchCodeqlVersion = "overlay_analysis_match_codeql_version",
123-
/**
124-
* Like `OverlayAnalysisMatchCodeqlVersion`, but only logs a diagnostic with the version that
125-
* would have been chosen instead of actually changing the default CodeQL CLI version.
126-
* `OverlayAnalysisMatchCodeqlVersion` overrides this flag.
127-
*/
128-
OverlayAnalysisMatchCodeqlVersionDryRun = "overlay_analysis_match_codeql_version_dry_run",
129123
/**
130124
* Lowers the overlay minimum available disk space to 8 GB. The lowest enabled limit wins; if
131125
* none are enabled, the default applies.
@@ -389,11 +383,6 @@ export const featureConfig = {
389383
envVar: "CODEQL_ACTION_OVERLAY_ANALYSIS_MATCH_CODEQL_VERSION",
390384
minimumVersion: undefined,
391385
},
392-
[Feature.OverlayAnalysisMatchCodeqlVersionDryRun]: {
393-
defaultValue: false,
394-
envVar: "CODEQL_ACTION_OVERLAY_ANALYSIS_MATCH_CODEQL_VERSION_DRY_RUN",
395-
minimumVersion: undefined,
396-
},
397386
[Feature.OverlayAnalysisMinDisk8Gb]: {
398387
defaultValue: false,
399388
envVar: "CODEQL_ACTION_OVERLAY_ANALYSIS_MIN_DISK_8_GB",

‎src/setup-codeql.test.ts‎

Lines changed: 2 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1727,7 +1727,7 @@ test.serial(
17271727
);
17281728

17291729
test.serial(
1730-
"getEnabledVersionsWithOverlayBaseDatabases does not list caches when both gates are off",
1730+
"getEnabledVersionsWithOverlayBaseDatabases does not list caches when the gate is off",
17311731
async (t) => {
17321732
const listStub = sinon.stub(api, "listActionsCaches").resolves([]);
17331733

@@ -1740,64 +1740,11 @@ test.serial(
17401740
t.deepEqual(result, []);
17411741
t.assert(
17421742
listStub.notCalled,
1743-
"Should not list Actions caches when both gating feature flags are off.",
1743+
"Should not list Actions caches when the gating feature flag is off.",
17441744
);
17451745
},
17461746
);
17471747

1748-
test.serial(
1749-
"getEnabledVersionsWithOverlayBaseDatabases dry-run returns empty but lists caches",
1750-
async (t) => {
1751-
sinon.stub(api, "getAutomationID").resolves("test/");
1752-
const listStub = sinon.stub(api, "listActionsCaches").resolves([
1753-
{
1754-
key: await fakeOverlayBaseCacheKey("javascript", "2.20.1", "abc-1-1"),
1755-
},
1756-
]);
1757-
1758-
const result = await setupCodeql.getEnabledVersionsWithOverlayBaseDatabases(
1759-
overlayMatchEnabledVersions,
1760-
["javascript"],
1761-
createFeatures([Feature.OverlayAnalysisMatchCodeqlVersionDryRun]),
1762-
getRunnerLogger(true),
1763-
);
1764-
t.deepEqual(
1765-
result,
1766-
[],
1767-
"Dry-run should return an empty list so the caller falls back.",
1768-
);
1769-
t.assert(
1770-
listStub.calledOnce,
1771-
"Dry-run should still list Actions caches to populate the diagnostic.",
1772-
);
1773-
},
1774-
);
1775-
1776-
test.serial(
1777-
"getEnabledVersionsWithOverlayBaseDatabases match flag wins over dry-run",
1778-
async (t) => {
1779-
sinon.stub(api, "getAutomationID").resolves("test/");
1780-
sinon.stub(api, "listActionsCaches").resolves([
1781-
{
1782-
key: await fakeOverlayBaseCacheKey("javascript", "2.20.1", "abc-1-1"),
1783-
},
1784-
]);
1785-
1786-
const result = await setupCodeql.getEnabledVersionsWithOverlayBaseDatabases(
1787-
overlayMatchEnabledVersions,
1788-
["javascript"],
1789-
createFeatures([
1790-
Feature.OverlayAnalysisMatchCodeqlVersion,
1791-
Feature.OverlayAnalysisMatchCodeqlVersionDryRun,
1792-
]),
1793-
getRunnerLogger(true),
1794-
);
1795-
t.deepEqual(result, [
1796-
{ cliVersion: "2.20.1", tagName: "codeql-bundle-v2.20.1" },
1797-
]);
1798-
},
1799-
);
1800-
18011748
/** The CLI version that the toolcache cleanup tests download. */
18021749
const CLEANUP_CLI_VERSION = "2.21.0";
18031750
/** The bundle version that the toolcache cleanup tests download. */

‎src/setup-codeql.ts‎

Lines changed: 3 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -183,10 +183,8 @@ async function findOverridingToolsInCache(
183183

184184
/**
185185
* Returns the sorted set of enabled versions that have cached overlay-base databases for the
186-
* given languages, or an empty list if neither the `OverlayAnalysisMatchCodeqlVersion` nor the
187-
* `OverlayAnalysisMatchCodeqlVersionDryRun` feature flag is enabled. When only the dry-run flag
188-
* is enabled, this performs the lookup and emits a telemetry diagnostic with the version that
189-
* would have been chosen, but still returns an empty list so the caller falls back.
186+
* given languages, or an empty list if the `OverlayAnalysisMatchCodeqlVersion` feature flag is
187+
* disabled.
190188
*/
191189
export async function getEnabledVersionsWithOverlayBaseDatabases(
192190
defaultCliVersion: CodeQLDefaultVersionInfo,
@@ -197,13 +195,7 @@ export async function getEnabledVersionsWithOverlayBaseDatabases(
197195
if (rawLanguages === undefined || rawLanguages.length === 0) {
198196
return [];
199197
}
200-
const isEnabled = await features.getValue(
201-
Feature.OverlayAnalysisMatchCodeqlVersion,
202-
);
203-
const isDryRun =
204-
!isEnabled &&
205-
(await features.getValue(Feature.OverlayAnalysisMatchCodeqlVersionDryRun));
206-
if (!isEnabled && !isDryRun) {
198+
if (!(await features.getValue(Feature.OverlayAnalysisMatchCodeqlVersion))) {
207199
return [];
208200
}
209201

@@ -234,35 +226,6 @@ export async function getEnabledVersionsWithOverlayBaseDatabases(
234226
return [];
235227
}
236228

237-
const isCachedVersionDifferent =
238-
overlayVersions[0].cliVersion !==
239-
defaultCliVersion.enabledVersions[0].cliVersion;
240-
241-
if (isCachedVersionDifferent) {
242-
addNoLanguageDiagnostic(
243-
undefined,
244-
makeTelemetryDiagnostic(
245-
"codeql-action/overlay-aware-default-codeql-version",
246-
"Overlay-aware default CodeQL version selection",
247-
{
248-
cachedVersions,
249-
enabledVersions: defaultCliVersion.enabledVersions.map(
250-
(v) => v.cliVersion,
251-
),
252-
isDryRun,
253-
overlayAwareVersion: overlayVersions[0].cliVersion,
254-
},
255-
),
256-
);
257-
}
258-
259-
if (isDryRun) {
260-
logger.debug(
261-
`Overlay-aware default CodeQL version selection is running in dry-run mode. Would have used version ${overlayVersions[0].cliVersion}.`,
262-
);
263-
return [];
264-
}
265-
266229
return overlayVersions;
267230
}
268231

0 commit comments

Comments
 (0)