Skip to content

Commit 05549f5

Browse files
committed
Debug zstd bundle extraction errors
1 parent 1c15a48 commit 05549f5

File tree

3 files changed

+62
-1
lines changed

3 files changed

+62
-1
lines changed

lib/tools-download.js

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

lib/tools-download.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/tools-download.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import * as path from "path";
55
import { performance } from "perf_hooks";
66

77
import * as core from "@actions/core";
8+
import * as toolrunner from "@actions/exec/lib/toolrunner";
89
import { HttpClient } from "@actions/http-client";
910
import * as toolcache from "@actions/tool-cache";
1011
import { https } from "follow-redirects";
@@ -148,6 +149,39 @@ export async function downloadAndExtract(
148149
)}).`,
149150
);
150151

152+
// Add the following log to display the size of the downloaded bundle
153+
const bundleSize = fs.statSync(archivedBundlePath).size;
154+
logger.info(`Size of the downloaded CodeQL bundle: ${bundleSize} bytes`);
155+
156+
// Run `zstd -t` on the CodeQL bundle and log the results
157+
let stdout = "";
158+
let stderr = "";
159+
try {
160+
const zstdTestRunner = new toolrunner.ToolRunner(
161+
"zstd",
162+
["-t", archivedBundlePath],
163+
{
164+
silent: true,
165+
listeners: {
166+
stdout: (data: Buffer) => {
167+
stdout += data.toString();
168+
},
169+
stderr: (data: Buffer) => {
170+
stderr += data.toString();
171+
},
172+
},
173+
},
174+
);
175+
const exitCode = await zstdTestRunner.exec();
176+
logger.info(`zstd -t exited with code ${exitCode}.`);
177+
} catch (error) {
178+
logger.warning(
179+
`Failed to verify the integrity of the CodeQL bundle using zstd: ${error}`,
180+
);
181+
}
182+
logger.info(`zstd -t stdout: ${stdout}`);
183+
logger.info(`zstd -t stderr: ${stderr}`);
184+
151185
let extractionDurationMs: number;
152186

153187
try {

0 commit comments

Comments
 (0)