Skip to content

Commit

Permalink
src: dump logs on build failure and experiment with LLB
Browse files Browse the repository at this point in the history
  • Loading branch information
adityamaru committed Nov 26, 2024
1 parent bdd6696 commit 8233c57
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,11 @@ async function getBuilderAddr(inputs: context.Inputs, dockerfilePath: string): P
core.debug('Successfully obtained sticky disk, proceeding to start buildkitd');

// Start buildkitd.
// Create a directory for LLB dumps
const llbDumpDir = '/tmp/buildkit-llb-dumps';
await execAsync(`mkdir -p ${llbDumpDir}`);
process.env.BUILDKIT_DEBUG_DUMPLLB = '1';
process.env.BUILDKIT_DUMP_LLB_DIR = llbDumpDir;
const parallelism = await getNumCPUs();
const buildkitdAddr = await startBuildkitd(parallelism);
core.debug(`buildkitd daemon started at addr ${buildkitdAddr}`);
Expand Down Expand Up @@ -746,6 +751,15 @@ actionsToolkit.run(
}
if (stateHelper.dockerBuildStatus != '') {
try {
if (stateHelper.dockerBuildStatus !== 'success' && stateHelper.buildRef) {
try {
const {stdout} = await execAsync(`sudo buildctl debug logs --ref ${stateHelper.buildRef}`);
core.info('Build logs from buildctl:');
core.info(stdout);
} catch (error) {
core.warning(`Failed to get buildctl logs: ${error.message}`);
}
}
await shutdownBuildkitd();
for (let attempt = 1; attempt <= 3; attempt++) {
try {
Expand Down

0 comments on commit 8233c57

Please sign in to comment.