Skip to content

ci-operator: Enable ErrTypeNotFound on the lease client#4893

Merged
openshift-merge-bot[bot] merged 2 commits intoopenshift:mainfrom
danilo-gemoli:feat/ci-operator/lease-type-not-exists
Feb 11, 2026
Merged

ci-operator: Enable ErrTypeNotFound on the lease client#4893
openshift-merge-bot[bot] merged 2 commits intoopenshift:mainfrom
danilo-gemoli:feat/ci-operator/lease-type-not-exists

Conversation

@danilo-gemoli
Copy link
Copy Markdown
Contributor

As of today, when the boskos' client tries to acquire a lease, it doesn't distinguish between these two error cases:

  1. There are no leases available anymore.
  2. The lease type we are trying to acquire simply doesn't exist.

The previous cases are both handled with the same ErrNotFound and, 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 ErrNotFound or ErrTypeNotFound.

@openshift-ci-robot
Copy link
Copy Markdown
Contributor

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: automatic mode

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jan 9, 2026

Important

Review skipped

Auto reviews are limited based on label configuration.

🚫 Review skipped — only excluded labels are configured. (1)
  • do-not-merge/work-in-progress

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Expose 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

Cohort / File(s) Summary
Lease client changes
pkg/lease/client.go
Add ErrTypeNotFound = boskos.ErrTypeNotFound; group ErrNotFound and ErrTypeNotFound in a single var block; set c.DistinguishNotFoundVsTypeNotFound = true on the constructed boskos client in NewClient.
E2E test config
test/e2e/lease/boskos.yaml
Replace aws-quota-slice numeric counts with a names array for three named quotas; add new resource aws-ip-pools-us-east-1 (min/max-count: 5, state: free); minor reflow of other resource entries.
E2E test code
test/e2e/lease/e2e_test.go
Change expected error message for invalid-lease case from "resources not found" to "resource type not found".
E2E step-registry scripts
test/e2e/lease/step-registry/check-leased-resource/check-leased-resource-commands.sh, test/e2e/lease/step-registry/check-leases/check-leases-commands.sh, test/e2e/lease/step-registry/declare-and-check-leases-with-count/declare-and-check-leases-with-count-commands.sh
Broaden regexes that validate lease IDs to accept either the previous UUID-like pattern or the literal us-east-1; adjust checks that validate multiple leases accordingly.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Comment @coderabbitai help to get the list of available commands and usage tips.

@openshift-ci openshift-ci Bot requested review from hector-vido and jmguzik January 9, 2026 14:47
@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 9, 2026
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a 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 ErrTypeNotFound should 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

📥 Commits

Reviewing files that changed from the base of the PR and between 36264d7 and 875a590.

📒 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

Comment thread pkg/lease/client.go
@danilo-gemoli danilo-gemoli force-pushed the feat/ci-operator/lease-type-not-exists branch from 875a590 to 006b348 Compare January 12, 2026 09:42
Copy link
Copy Markdown
Contributor

@jmguzik jmguzik left a comment

Choose a reason for hiding this comment

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

/retest

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Feb 9, 2026
@danilo-gemoli
Copy link
Copy Markdown
Contributor Author

/test e2e

@openshift-ci openshift-ci Bot removed the lgtm Indicates that a PR is ready to be merged. label Feb 10, 2026
@danilo-gemoli
Copy link
Copy Markdown
Contributor Author

/test e2e

@danilo-gemoli danilo-gemoli force-pushed the feat/ci-operator/lease-type-not-exists branch from 573282d to 53aceb3 Compare February 10, 2026 13:21
@danilo-gemoli
Copy link
Copy Markdown
Contributor Author

/test e2e

@danilo-gemoli danilo-gemoli force-pushed the feat/ci-operator/lease-type-not-exists branch from 53aceb3 to d67d736 Compare February 10, 2026 16:39
@danilo-gemoli
Copy link
Copy Markdown
Contributor Author

/test e2e

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

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 | 🟠 Major

Update 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 string us-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.

@danilo-gemoli danilo-gemoli force-pushed the feat/ci-operator/lease-type-not-exists branch from d67d736 to e661b8c Compare February 11, 2026 08:17
@danilo-gemoli
Copy link
Copy Markdown
Contributor Author

/test e2e

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Feb 11, 2026
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Feb 11, 2026

[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

Details Needs approval from an approver in each of these files:
  • OWNERS [danilo-gemoli,jmguzik]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@danilo-gemoli
Copy link
Copy Markdown
Contributor Author

/retest-required

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Feb 11, 2026

@danilo-gemoli: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/breaking-changes e661b8c link false /test breaking-changes

Full PR test history. Your PR dashboard.

Details

Instructions 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.

@openshift-merge-bot openshift-merge-bot Bot merged commit 2b06ca6 into openshift:main Feb 11, 2026
13 of 14 checks passed
@danilo-gemoli danilo-gemoli deleted the feat/ci-operator/lease-type-not-exists branch March 4, 2026 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants