Skip to content

fix: Add actionable logs and improve UX after buildkit endpoint checks are exhausted #1186

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

amanycodes
Copy link
Contributor

@amanycodes amanycodes commented Jul 3, 2025

After all the buildkit endpoint checks fail the user is prompted with an error message telling them copa can't function and our custom-address docs are provided for next steps

Also improved the logic of printing nil error:
could not use buildkitd driver: %!w(<nil>)
when the last dummy client connection succeeds but validation check fails for builkitd driver check

Closes #977

Copy link

codecov bot commented Jul 3, 2025

Codecov Report

Attention: Patch coverage is 0% with 10 lines in your changes missing coverage. Please review.

Project coverage is 42.59%. Comparing base (143697e) to head (80948f1).

Files with missing lines Patch % Lines
pkg/buildkit/drivers.go 0.00% 10 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1186      +/-   ##
==========================================
- Coverage   42.67%   42.59%   -0.09%     
==========================================
  Files          24       24              
  Lines        3934     3942       +8     
==========================================
  Hits         1679     1679              
- Misses       2127     2135       +8     
  Partials      128      128              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

return c, nil
}
c.Close()
}
log.WithError(err).Debug("Could not use buildkitd driver")
return nil, errors.Join(retErr, fmt.Errorf("could not use buildkitd driver: %w", err))
if err == nil {
err = validateErr
Copy link
Contributor

Choose a reason for hiding this comment

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

why did we change err to validateErr and set it here again?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this improved the logic of printing nil error:
could not use buildkitd driver: %!w(<nil>)
when the last dummy client connection succeeds but validation check fails for builkitd driver check

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I saw this in the user logs they shared in the issue

return nil, fmt.Errorf(
"%w\n\nAll BuildKit connection checks exhausted. Copa requires a working BuildKit instance to function.\n"+
"Please refer to the documentation for setup instructions: https://project-copacetic.github.io/copacetic/website/custom-address",
errors.Join(retErr, fmt.Errorf("could not use buildkitd driver: %w", err)),
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe in the docs also we can explicitly clarify that for Docker Desktop default connection containerd image store needs to be enabled as it says in the issue?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes i was thinking exactly about this! In the custom address docs we can explicitly clarify this using an admonition and mentioning that for Docker Desktop default connection containerd image store needs to be enabled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🆕 New
Development

Successfully merging this pull request may close these issues.

[BUG] actionable error message after buildkit endpoint checks are exhausted
2 participants