ci-operator: Enable ErrTypeNotFound on the lease client#4893
Conversation
|
Pipeline controller notification For optional jobs, comment This repository is configured in: automatic mode |
|
Important Review skippedAuto reviews are limited based on label configuration. 🚫 Review skipped — only excluded labels are configured. (1)
Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Use the checkbox below for a quick retry:
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughExpose a new exported error ErrTypeNotFound and consolidate error vars in pkg/lease/client.go; enable DistinguishNotFoundVsTypeNotFound on the underlying boskos client. Update e2e fixtures and tests: adjust boskos.yaml resources/names, add aws-ip-pools-us-east-1, and broaden lease regexes and expected error text in e2e tests. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes ✨ Finishing touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
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
|
/test e2e |
|
/test e2e |
573282d to
53aceb3
Compare
|
/test e2e |
53aceb3 to
d67d736
Compare
|
/test e2e |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
test/e2e/lease/step-registry/check-leases/check-leases-commands.sh (1)
1-5:⚠️ Potential issue | 🟠 MajorUpdate regex to match actual boskos resource names.
The boskos fixture provides resource names like
us-east-1--aws-quota-slice-00, but the current regex pattern only accepts UUIDs or the literal stringus-east-1. The pattern[[:alnum:]]matches only alphanumerics, not hyphens, so names containing--and trailing alphanumerics will fail validation. Update the regex to account for the full resource name format.
d67d736 to
e661b8c
Compare
|
/test e2e |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: danilo-gemoli, jmguzik 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 |
|
/retest-required |
|
@danilo-gemoli: The following test 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. |
2b06ca6
into
openshift:main
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.