-
Notifications
You must be signed in to change notification settings - Fork 292
ci-operator: Enable ErrTypeNotFound on the lease client #4893
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
base: main
Are you sure you want to change the base?
ci-operator: Enable ErrTypeNotFound on the lease client #4893
Conversation
|
Pipeline controller notification For optional jobs, comment This repository is configured in: automatic mode |
WalkthroughAdded Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes ✨ Finishing touches
📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro Cache: Disabled due to data retention organization setting Knowledge base: Disabled due to 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Comment |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: danilo-gemoli The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In @pkg/lease/client.go:
- Around line 70-74: Move the assignment to c.DistinguishNotFoundVsTypeNotFound
so it happens after verifying the client was created successfully: call
boskos.NewClientWithPasswordGetter(owner, url, username, passwordGetter), check
if err != nil and return on error, then set c.DistinguishNotFoundVsTypeNotFound
= true; this avoids dereferencing a nil c when NewClientWithPasswordGetter
fails.
🧹 Nitpick comments (1)
pkg/lease/client.go (1)
32-35: Add documentation for the new exported error.The new public error
ErrTypeNotFoundshould have a doc comment explaining when it's returned (e.g., when the requested lease type doesn't exist in the boskos server).📝 Suggested documentation
+// ErrNotFound is returned when no resources of the requested type are currently available. +// ErrTypeNotFound is returned when the requested resource type does not exist. var ( ErrNotFound = boskos.ErrNotFound ErrTypeNotFound = boskos.ErrTypeNotFound )
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting
📒 Files selected for processing (1)
pkg/lease/client.go
🧰 Additional context used
📓 Path-based instructions (1)
**
⚙️ CodeRabbit configuration file
-Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity.
Files:
pkg/lease/client.go
875a590 to
006b348
Compare
|
@danilo-gemoli: The following tests failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
As of today, when the boskos' client tries to acquire a lease, it doesn't distinguish between these two error cases:
The previous cases are both handled with the same
ErrNotFoundand, as a consequence, the client keeps retrying to acquire a lease even when it doesn't make any sense (the type doesn't exist).Furthermore, with the upcoming "intra-step leasing" feature, clients want to implement the "let's try to acquire a lease of type X, if it exists" behavior, which requires the boskos' client to be able to tell whether an error is
ErrNotFoundorErrTypeNotFound.