Skip to content

Conversation

@danilo-gemoli
Copy link
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
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

coderabbitai bot commented Jan 9, 2026

Walkthrough

Added ErrTypeNotFound to the lease package, consolidated error variable declarations into a grouped var block, and set DistinguishNotFoundVsTypeNotFound = true on the underlying boskos client in NewClient.

Changes

Cohort / File(s) Summary
Error declarations & client config
pkg/lease/client.go
Added ErrTypeNotFound = boskos.ErrTypeNotFound; consolidated ErrNotFound and ErrTypeNotFound into a single var block; enabled c.DistinguishNotFoundVsTypeNotFound = true in NewClient.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent 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 875a590 and 006b348.

📒 Files selected for processing (1)
  • pkg/lease/client.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • pkg/lease/client.go

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
Copy link
Contributor

openshift-ci bot commented Jan 9, 2026

[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

Details Needs approval from an approver in each of these files:

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

@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

@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

@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
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 12, 2026

@danilo-gemoli: The following tests 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/images 006b348 link true /test images
ci/prow/breaking-changes 006b348 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.

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants