Skip to content

Commit 90c42c4

Browse files
committed
Improve logging
1 parent df0590b commit 90c42c4

9 files changed

+26
-9
lines changed

lib/codeql.js

+3-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/codeql.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/setup-codeql.js

+2-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/setup-codeql.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/tools-download.js

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/tools-download.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/codeql.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,9 @@ export async function getCodeQLForCmd(
544544
async getVersion() {
545545
let result = util.getCachedCodeQlVersion();
546546
if (result === undefined) {
547-
const output = await runCli(cmd, ["version", "--format=json"]);
547+
const output = await runCli(cmd, ["version", "--format=json"], {
548+
noStreamStdout: true,
549+
});
548550
try {
549551
result = JSON.parse(output) as VersionInfo;
550552
} catch {

src/setup-codeql.ts

+7-3
Original file line numberDiff line numberDiff line change
@@ -517,9 +517,6 @@ export const downloadCodeQL = async function (
517517
} else {
518518
logger.debug("Downloading CodeQL tools without an authorization token.");
519519
}
520-
logger.info(
521-
`Downloading CodeQL tools from ${codeqlURL} . This may take a while.`,
522-
);
523520

524521
const { extractedBundlePath, statusReport } = await downloadAndExtract(
525522
codeqlURL,
@@ -552,12 +549,19 @@ export const downloadCodeQL = async function (
552549
bundleVersion,
553550
logger,
554551
);
552+
const toolcacheStart = performance.now();
555553
const toolcachedBundlePath = await toolcache.cacheDir(
556554
extractedBundlePath,
557555
"CodeQL",
558556
toolcacheVersion,
559557
);
560558

559+
logger.info(
560+
`Added CodeQL bundle to the tool cache (${
561+
performance.now() - toolcacheStart
562+
} ms).`,
563+
);
564+
561565
// Defensive check: we expect `cacheDir` to copy the bundle to a new location.
562566
if (toolcachedBundlePath !== extractedBundlePath) {
563567
await cleanUpGlob(

src/tools-download.ts

+6
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,18 @@ export async function downloadAndExtract(
5353
extractedBundlePath: string;
5454
statusReport: ToolsDownloadStatusReport;
5555
}> {
56+
logger.info(
57+
`Downloading CodeQL tools from ${codeqlURL} . This may take a while.`,
58+
);
59+
5660
const compressionMethod = tar.inferCompressionMethod(codeqlURL);
5761

5862
if (
5963
compressionMethod === "zstd" &&
6064
(await features.getValue(Feature.ZstdBundleStreamingExtraction))
6165
) {
66+
logger.info(`Streaming the extraction of the CodeQL bundle.`);
67+
6268
const toolsInstallStart = performance.now();
6369
const extractedBundlePath = await downloadAndExtractZstdWithStreaming(
6470
codeqlURL,

0 commit comments

Comments
 (0)