Skip to content

Commit

Permalink
Improve logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Henry Mercer committed Oct 10, 2024
1 parent df0590b commit 90c42c4
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 9 deletions.
4 changes: 3 additions & 1 deletion lib/codeql.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/codeql.js.map

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion lib/setup-codeql.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/setup-codeql.js.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions lib/tools-download.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/tools-download.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion src/codeql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,9 @@ export async function getCodeQLForCmd(
async getVersion() {
let result = util.getCachedCodeQlVersion();
if (result === undefined) {
const output = await runCli(cmd, ["version", "--format=json"]);
const output = await runCli(cmd, ["version", "--format=json"], {
noStreamStdout: true,
});
try {
result = JSON.parse(output) as VersionInfo;
} catch {
Expand Down
10 changes: 7 additions & 3 deletions src/setup-codeql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -517,9 +517,6 @@ export const downloadCodeQL = async function (
} else {
logger.debug("Downloading CodeQL tools without an authorization token.");
}
logger.info(
`Downloading CodeQL tools from ${codeqlURL} . This may take a while.`,
);

const { extractedBundlePath, statusReport } = await downloadAndExtract(
codeqlURL,
Expand Down Expand Up @@ -552,12 +549,19 @@ export const downloadCodeQL = async function (
bundleVersion,
logger,
);
const toolcacheStart = performance.now();
const toolcachedBundlePath = await toolcache.cacheDir(
extractedBundlePath,
"CodeQL",
toolcacheVersion,
);

logger.info(
`Added CodeQL bundle to the tool cache (${
performance.now() - toolcacheStart
} ms).`,
);

// Defensive check: we expect `cacheDir` to copy the bundle to a new location.
if (toolcachedBundlePath !== extractedBundlePath) {
await cleanUpGlob(
Expand Down
6 changes: 6 additions & 0 deletions src/tools-download.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,18 @@ export async function downloadAndExtract(
extractedBundlePath: string;
statusReport: ToolsDownloadStatusReport;
}> {
logger.info(
`Downloading CodeQL tools from ${codeqlURL} . This may take a while.`,
);

const compressionMethod = tar.inferCompressionMethod(codeqlURL);

if (
compressionMethod === "zstd" &&
(await features.getValue(Feature.ZstdBundleStreamingExtraction))
) {
logger.info(`Streaming the extraction of the CodeQL bundle.`);

const toolsInstallStart = performance.now();
const extractedBundlePath = await downloadAndExtractZstdWithStreaming(
codeqlURL,
Expand Down

0 comments on commit 90c42c4

Please sign in to comment.