Skip to content
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

src: dump logs on build failure and experiment with LLB #43

Closed
wants to merge 1 commit into from

Conversation

adityamaru
Copy link

@adityamaru adityamaru commented Nov 26, 2024

Important

Enhances logging on build failure by capturing debug logs and setting up LLB dump directory in main.ts.

  • Behavior:
    • Captures buildctl debug logs on build failure if stateHelper.dockerBuildStatus is not 'success' in main.ts.
    • Creates /tmp/buildkit-llb-dumps directory and sets BUILDKIT_DEBUG_DUMPLLB and BUILDKIT_DUMP_LLB_DIR in getBuilderAddr().
  • Misc:
    • Adds error handling for buildctl debug logs command in main.ts.

This description was created by Ellipsis for 92bff7f. It will automatically update as commits are pushed.

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks good to me! Reviewed everything up to 8233c57 in 20 seconds

More details
  • Looked at 32 lines of code in 1 files
  • Skipped 2 files when reviewing.
  • Skipped posting 2 drafted comments based on config settings.
1. src/main.ts:423
  • Draft comment:
    Using execAsync with unsanitized input can lead to command injection vulnerabilities. Ensure that variables like llbDumpDir are properly sanitized or use a safer method to handle directory creation.
  • Reason this comment was not posted:
    Comment did not seem useful.
2. src/main.ts:756
  • Draft comment:
    Using execAsync with unsanitized input can lead to command injection vulnerabilities. Ensure that variables like stateHelper.buildRef are properly sanitized or use a safer method to handle command execution.
  • Reason this comment was not posted:
    Comment did not seem useful.

Workflow ID: wflow_WENPqP2WnxdHy5Hw


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

2 days left in your free trial, upgrade for $20/seat/month or contact us.

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks good to me! Incremental review on df30dab in 28 seconds

More details
  • Looked at 39 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 3 drafted comments based on config settings.
1. src/main.ts:289
  • Draft comment:
    Using sudo for executing commands can be a security risk. Ensure that the commands are safe and the environment is secure.
  • Reason this comment was not posted:
    Comment did not seem useful.
2. src/main.ts:423
  • Draft comment:
    Ensure that the command executed with execAsync is safe and properly handles potential errors.
  • Reason this comment was not posted:
    Marked as duplicate.
3. src/main.ts:754
  • Draft comment:
    Ensure that the command executed with execAsync is safe and properly handles potential errors.
  • Reason this comment was not posted:
    Comment did not seem useful.

Workflow ID: wflow_Qgu1IovuE91eqZYf


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

2 days left in your free trial, upgrade for $20/seat/month or contact us.

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ Changes requested. Incremental review on 7309a49 in 59 seconds

More details
  • Looked at 39 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 drafted comments based on config settings.
1. src/main.ts:286
  • Draft comment:
    Consider adding error handling for the execAsync call that creates the /run/buildkit directory to ensure robustness.
  • Reason this comment was not posted:
    Comment was not on a valid diff hunk.
2. src/main.ts:287
  • Draft comment:
    Consider adding error handling for the execAsync call that changes permissions of the /run/buildkit directory to ensure robustness.
  • Reason this comment was not posted:
    Comment was on unchanged code.

Workflow ID: wflow_3UwUkibLP2I8gmXX


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

2 days left in your free trial, upgrade for $20/seat/month or contact us.

@@ -418,6 +418,9 @@ 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}`);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding error handling for the execAsync call that creates the LLB dump directory to ensure robustness.

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ Changes requested. Incremental review on 92bff7f in 1 minute and 1 seconds

More details
  • Looked at 39 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. src/main.ts:292
  • Draft comment:
    Consider checking the exit code of the execAsync command instead of relying solely on stderr to determine if the command failed. This will provide a more reliable error handling mechanism.
  • Reason this comment was not posted:
    Comment was on unchanged code.

Workflow ID: wflow_wprbRHvh3A8JEFz8


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

2 days left in your free trial, upgrade for $20/seat/month or contact us.

@@ -418,6 +418,9 @@ 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}`);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add error handling for the mkdir command to ensure that any issues during directory creation are properly managed. This applies to the mkdir command in getBuilderAddr as well.

@@ -746,6 +749,15 @@ actionsToolkit.run(
}
if (stateHelper.dockerBuildStatus != '') {
try {
if (stateHelper.dockerBuildStatus !== 'success' && stateHelper.buildRef) {
try {
const {stdout} = await execAsync(`sudo buildctl debug logs ${stateHelper.buildRef}`);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding more context or retry logic for the execAsync command when fetching buildctl debug logs to handle potential errors more gracefully.

@adityamaru adityamaru closed this Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant