8000 Merge pull request #1496 from github/henrymercer/no-cache-nightlies · github/codeql-action@421a1b3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 421a1b3

Browse files
authored
Merge pull request #1496 from github/henrymercer/no-cache-nightlies
Increase strictness of tool caching threshold to avoid caching nightlies
2 parents 6456115 + 54f4ea7 commit 421a1b3

File tree

6 files changed

+22
-10
lines changed

6 files changed

+22
-10
lines changed

lib/codeql.test.js

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/codeql.test.js.map

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

lib/setup-codeql.js

Lines changed: 6 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/setup-codeql.js.map

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

src/codeql.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,10 @@ const EXPLICITLY_REQUESTED_BUNDLE_TEST_CASES = [
248248
cliVersion: "2.10.0-pre",
249249
expectedToolcacheVersion: "0.0.0-20200610",
250250
},
251+
{
252+
cliVersion: "2.10.0+202006100101",
253+
expectedToolcacheVersion: "0.0.0-20200610",
254+
},
251255
];
252256

253257
for (const {

src/setup-codeql.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -565,11 +565,13 @@ export async function downloadCodeQL(
565565
// if the user requests the same URL again, we can get it from the cache without having to call
566566
// any of the Releases API.
567567
//
568-
// Special case: If the CLI version is a pre-release, then cache the bundle as
569-
// `0.0.0-<bundleVersion>` to avoid the bundle being interpreted as containing a stable CLI
570-
// release.
568+
// Special case: If the CLI version is a pre-release or contains build metadata, then cache the
569+
// bundle as `0.0.0-<bundleVersion>` to avoid the bundle being interpreted as containing a stable
570+
// CLI release. In principle, it should be enough to just check that the CLI version isn't a
571+
// pre-release, but the version numbers of CodeQL nightlies have the format `x.y.z+<timestamp>`,
572+
// and we don't want these nightlies to override stable CLI versions in the toolcache.
571573
const toolcacheVersion =
572-
cliVersion && !cliVersion.includes("-")
574+
cliVersion && cliVersion.match(/^[0-9]+\.[0-9]+\.[0-9]+$/)
573575
? `${cliVersion}-${bundleVersion}`
574576
: convertToSemVer(bundleVersion, logger);
575577
return {

0 commit comments

Comments
 (0)
0