Skip to content

Support streaming the download and extraction of zstd bundles #2538

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Improve logging
  • Loading branch information
henrymercer committed Oct 10, 2024
commit 90c42c41ec3c4dd6d8cc98601872d0653f7b5da9
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
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy