Add test for CodeQL version appearing in log.

This commit is contained in:
Fotis Koutoulakis (@NlightNFotis) 2024-05-09 14:33:54 +01:00 committed by Fotis Koutoulakis
parent cff15d7117
commit c92bbd4223
6 changed files with 80 additions and 48 deletions

8
lib/setup-codeql.js generated
View file

@ -380,7 +380,7 @@ async function tryGetFallbackToolcacheVersion(cliVersion, tagName, logger) {
return fallbackVersion;
}
exports.tryGetFallbackToolcacheVersion = tryGetFallbackToolcacheVersion;
async function downloadCodeQL(codeqlURL, maybeBundleVersion, maybeCliVersion, apiDetails, variant, tempDir, logger) {
const downloadCodeQL = async function (codeqlURL, maybeBundleVersion, maybeCliVersion, apiDetails, variant, tempDir, logger) {
const parsedCodeQLURL = new URL(codeqlURL);
const searchParams = new URLSearchParams(parsedCodeQLURL.search);
const headers = {
@ -443,7 +443,7 @@ async function downloadCodeQL(codeqlURL, maybeBundleVersion, maybeCliVersion, ap
codeqlFolder: toolcachedBundlePath,
toolsDownloadDurationMs,
};
}
};
exports.downloadCodeQL = downloadCodeQL;
function getCodeQLURLVersion(url) {
const match = url.match(/\/codeql-bundle-(.*)\//);
@ -495,7 +495,7 @@ function getCanonicalToolcacheVersion(cliVersion, bundleVersion, logger) {
*/
async function setupCodeQLBundle(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, logger) {
const source = await getCodeQLSource(toolsInput, defaultCliVersion, apiDetails, variant, logger);
logger.info("Using CodeQL CLI version: " + source.toolsVersion + " from " + source.sourceType);
logger.info("Using CodeQL CLI version " + source.toolsVersion + " from " + source.sourceType + ".");
let codeqlFolder;
let toolsVersion = source.toolsVersion;
let toolsDownloadDurationMs;
@ -511,7 +511,7 @@ async function setupCodeQLBundle(toolsInput, apiDetails, tempDir, variant, defau
toolsSource = ToolsSource.Toolcache;
break;
case "download": {
const result = await downloadCodeQL(source.codeqlURL, source.bundleVersion, source.cliVersion, apiDetails, variant, tempDir, logger);
const result = await (0, exports.downloadCodeQL)(source.codeqlURL, source.bundleVersion, source.cliVersion, apiDetails, variant, tempDir, logger);
toolsVersion = result.toolsVersion;
codeqlFolder = result.codeqlFolder;
toolsDownloadDurationMs = result.toolsDownloadDurationMs;