ci-tools icon indicating copy to clipboard operation
ci-tools copied to clipboard

ci-operator: Enable ErrTypeNotFound on the lease client

Open danilo-gemoli opened this issue 1 month ago • 4 comments

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.

danilo-gemoli avatar Jan 09 '26 14:01 danilo-gemoli

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

openshift-ci-robot avatar Jan 09 '26 14:01 openshift-ci-robot

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 875a590daf56288d632c65973b3dbbf56a8381a8 and 006b348e7a3278eb788680ae998859b63ae5ff2b.

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

coderabbitai[bot] avatar Jan 09 '26 14:01 coderabbitai[bot]

[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

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[bot] avatar Jan 09 '26 14:01 openshift-ci[bot]

@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 006b348e7a3278eb788680ae998859b63ae5ff2b link true /test images
ci/prow/breaking-changes 006b348e7a3278eb788680ae998859b63ae5ff2b link false /test breaking-changes

Full PR test history. Your PR dashboard.

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-ci[bot] avatar Jan 12 '26 11:01 openshift-ci[bot]