Skip to content

Add Synthetic lease-proxy-server Step#4948

Open
danilo-gemoli wants to merge 1 commit intoopenshift:mainfrom
danilo-gemoli:feat/ci-operator/lease-proxy-step
Open

Add Synthetic lease-proxy-server Step#4948
danilo-gemoli wants to merge 1 commit intoopenshift:mainfrom
danilo-gemoli:feat/ci-operator/lease-proxy-step

Conversation

@danilo-gemoli
Copy link
Contributor

Introduce a fake lease-proxy-server step that I will implement with several upcoming PRs.
As of now, the step is required by the multistage step only

The code is dumb: a new step is added to the execution graph and it always succeeds. The lease-proxy-server exists only when a lease client is available. It wouldn't make any sense otherwise.

@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 Feb 16, 2026

Walkthrough

This pull request introduces a lease proxy server feature to the CI operator. It adds configuration flags, new step link types for dependency modeling, a lease proxy step implementation, and integrates these components into the multi-stage test infrastructure through additional dependencies and test updates.

Changes

Cohort / File(s) Summary
Configuration and Initialization
cmd/ci-operator/main.go, pkg/defaults/config.go, pkg/defaults/defaults.go
Added helper method isLeaseClientAvailable() to check lease server availability. Introduced LeaseClientEnabled flag to Clients struct. Implemented leaseProxyServerStep() helper function to conditionally append lease proxy server step to build steps when enabled.
Lease Proxy Step Implementation
pkg/steps/lease_proxy.go
New file introducing stepLeaseProxyServer type implementing api.Step interface with lifecycle methods (Inputs, Name, Description, Requires, Creates, Provides, Objects, Validate). Exposes LeaseProxyStep() constructor. Run method logs placeholder "TODO - Not implemented" message.
Step Link Graph Extensions
pkg/api/graph.go
Added LeaseProxyServerLink() and LeaseProxyServerReadyLink() constructors for new StepLink implementations modeling lease proxy server lifecycle dependencies and satisfaction logic.
Multi-stage Dependencies
pkg/steps/multi_stage/multi_stage.go, pkg/steps/multi_stage/multi_stage_test.go
Updated multiStageTestStep.Requires() to include LeaseProxyServerLink() as an additional dependency. Updated test cases to expect LeaseProxyServerReadyLink() in required step link sequences.
Test Updates
pkg/defaults/defaults_test.go
Updated test setup to populate LeaseClientEnabled field alongside LeaseClient. Added test scenario enabling lease proxy server with expectation of "lease-proxy-server" runtime step.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

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

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.5.0)

Command failed

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


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

ret = append(ret, api.ReleaseImagesLink(releaseName))
}

ret = append(ret, api.LeaseProxyServerLink())
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here we declare the new dependency.

@openshift-ci openshift-ci bot requested review from Prucek and deepsm007 February 16, 2026 13:27
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Feb 16, 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 Feb 16, 2026
func (*stepLeaseProxyServer) Description() string { return "" }
func (*stepLeaseProxyServer) Requires() []api.StepLink { return nil }
func (*stepLeaseProxyServer) Creates() []api.StepLink {
return []api.StepLink{api.LeaseProxyServerReadyLink()}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

And here we resolve the dependency.

@danilo-gemoli danilo-gemoli changed the title Add Syntethic lease-proxy-server Step Add Synthetic lease-proxy-server Step Feb 16, 2026
@danilo-gemoli
Copy link
Contributor Author

/test e2e

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: 2

🤖 Fix all issues with AI agents
In `@pkg/api/graph.go`:
- Around line 285-316: LeaseProxyServerReadyLink.SatisfiedBy currently returns
true for any StepLink, which incorrectly marks any requirement satisfied; change
the implementation of leaseProxyServerReadyLink.SatisfiedBy to only return true
when the other link is either *leaseProxyServerLink or
*leaseProxyServerReadyLink (mirroring the pattern used by
imagesReadyLink/rpmRepoLink) so that HasAllLinks only treats the actual lease
proxy link (or itself) as satisfying the requirement.

In `@pkg/steps/multi_stage/multi_stage.go`:
- Around line 328-330: The code always appends api.LeaseProxyServerLink() in the
multi-stage step construction, which creates an unsatisfied dependency when no
lease client is present; modify the multiStageTestStep construction to consult
the lease-client availability (e.g., add or use a LeaseClientEnabled boolean on
the multiStageTestStep struct) and only append api.LeaseProxyServerLink() when
that flag is true in the function that currently does "ret = append(ret,
api.LeaseProxyServerLink())" (or alternatively ensure the lease-proxy step
itself is always added so the link can be satisfied); update any
callers/constructors of multiStageTestStep to thread the flag through.
🧹 Nitpick comments (1)
pkg/steps/lease_proxy.go (1)

39-45: Consider a cleaner linter workaround or removing the unused import.

The if 1 == 2 block is unconventional. If fmt is needed for future implementation, a common pattern is to use a blank identifier assignment like var _ = fmt.Errorf at package level, or simply remove the import until actual implementation. Since this is a temporary stub, this is a minor point.

♻️ Alternative approach
-func (s *stepLeaseProxyServer) run(context.Context) error {
-	if 1 == 2 {
-		return fmt.Errorf("unreachable code to make the linter happy. Will be removed soon.")
-	}
-	s.logger.Info("TODO - Not implemented")
-	return nil
-}
+func (s *stepLeaseProxyServer) run(context.Context) error {
+	s.logger.Info("TODO - Not implemented")
+	return nil
+}

And remove the "fmt" import until it's needed.

Comment on lines +285 to +316
func LeaseProxyServerLink() StepLink {
return &leaseProxyServerLink{}
}

type leaseProxyServerLink struct{}

func (*leaseProxyServerLink) SatisfiedBy(other StepLink) bool {
switch other.(type) {
case *leaseProxyServerReadyLink:
return true
default:
return false
}
}

func (*leaseProxyServerLink) UnsatisfiableError() string {
return ""
}

func LeaseProxyServerReadyLink() StepLink {
return &leaseProxyServerReadyLink{}
}

type leaseProxyServerReadyLink struct{}

func (*leaseProxyServerReadyLink) SatisfiedBy(StepLink) bool {
return true
}

func (*leaseProxyServerReadyLink) UnsatisfiableError() string {
return ""
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

find . -name "*.go" -type f | xargs grep -l "lease_proxy\|LeaseProxy" | head -20

Repository: openshift/ci-tools

Length of output: 217


🏁 Script executed:

rg -n "LeaseProxyServerReadyLink|LeaseProxyServerLink|Creates\(" -g '!vendor' -A 3 | head -100

Repository: openshift/ci-tools

Length of output: 5779


🏁 Script executed:

rg -n "HasAllLinks\|SatisfiedBy" pkg/api/graph.go -A 5 | head -50

Repository: openshift/ci-tools

Length of output: 44


🏁 Script executed:

cat -n pkg/steps/lease_proxy.go | head -100

Repository: openshift/ci-tools

Length of output: 1871


🏁 Script executed:

rg -n "Creates\(\)" pkg/steps/lease_proxy.go -A 2

Repository: openshift/ci-tools

Length of output: 184


🏁 Script executed:

rg -n "HasAllLinks\|func.*SatisfiedBy" pkg/api/ -A 10

Repository: openshift/ci-tools

Length of output: 44


🏁 Script executed:

sed -n '320,340p' pkg/steps/multi_stage/multi_stage.go

Repository: openshift/ci-tools

Length of output: 767


🏁 Script executed:

rg -n "HasAllLinks" . -g '!vendor' -A 5

Repository: openshift/ci-tools

Length of output: 1357


🏁 Script executed:

rg -n "SatisfiedBy" . -g '!vendor' -B 3 -A 3

Repository: openshift/ci-tools

Length of output: 6113


🏁 Script executed:

rg -n "ImagesReadyLink\|ImagesLink" pkg/api/graph.go -B 2 -A 8

Repository: openshift/ci-tools

Length of output: 44


🏁 Script executed:

sed -n '602,612p' pkg/api/graph.go

Repository: openshift/ci-tools

Length of output: 300


🏁 Script executed:

rg -n "ImagesReadyLink\|RpmRepoLink" pkg/api/graph.go | grep -A 5 "SatisfiedBy"

Repository: openshift/ci-tools

Length of output: 44


Fix LeaseProxyServerReadyLink.SatisfiedBy to prevent incorrect dependency satisfaction.

Line 310 returns true for any StepLink, which will incorrectly satisfy all requirements in HasAllLinks. This breaks dependency ordering—any step's requirement will appear satisfied once the lease proxy step runs, even if the actual required link wasn't created. Fix by restricting SatisfiedBy to only match LeaseProxyServerLink and itself, following the pattern used by other ready links like imagesReadyLink and rpmRepoLink.

Fix
-func (*leaseProxyServerReadyLink) SatisfiedBy(StepLink) bool {
-	return true
-}
+func (*leaseProxyServerReadyLink) SatisfiedBy(other StepLink) bool {
+	switch other.(type) {
+	case *leaseProxyServerLink, *leaseProxyServerReadyLink:
+		return true
+	default:
+		return false
+	}
+}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
func LeaseProxyServerLink() StepLink {
return &leaseProxyServerLink{}
}
type leaseProxyServerLink struct{}
func (*leaseProxyServerLink) SatisfiedBy(other StepLink) bool {
switch other.(type) {
case *leaseProxyServerReadyLink:
return true
default:
return false
}
}
func (*leaseProxyServerLink) UnsatisfiableError() string {
return ""
}
func LeaseProxyServerReadyLink() StepLink {
return &leaseProxyServerReadyLink{}
}
type leaseProxyServerReadyLink struct{}
func (*leaseProxyServerReadyLink) SatisfiedBy(StepLink) bool {
return true
}
func (*leaseProxyServerReadyLink) UnsatisfiableError() string {
return ""
}
func LeaseProxyServerLink() StepLink {
return &leaseProxyServerLink{}
}
type leaseProxyServerLink struct{}
func (*leaseProxyServerLink) SatisfiedBy(other StepLink) bool {
switch other.(type) {
case *leaseProxyServerReadyLink:
return true
default:
return false
}
}
func (*leaseProxyServerLink) UnsatisfiableError() string {
return ""
}
func LeaseProxyServerReadyLink() StepLink {
return &leaseProxyServerReadyLink{}
}
type leaseProxyServerReadyLink struct{}
func (*leaseProxyServerReadyLink) SatisfiedBy(other StepLink) bool {
switch other.(type) {
case *leaseProxyServerLink, *leaseProxyServerReadyLink:
return true
default:
return false
}
}
func (*leaseProxyServerReadyLink) UnsatisfiableError() string {
return ""
}
🤖 Prompt for AI Agents
In `@pkg/api/graph.go` around lines 285 - 316,
LeaseProxyServerReadyLink.SatisfiedBy currently returns true for any StepLink,
which incorrectly marks any requirement satisfied; change the implementation of
leaseProxyServerReadyLink.SatisfiedBy to only return true when the other link is
either *leaseProxyServerLink or *leaseProxyServerReadyLink (mirroring the
pattern used by imagesReadyLink/rpmRepoLink) so that HasAllLinks only treats the
actual lease proxy link (or itself) as satisfying the requirement.

Comment on lines +328 to 330

ret = append(ret, api.LeaseProxyServerLink())
return
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Guard LeaseProxyServerLink on lease-client availability.

Line 328 adds LeaseProxyServerLink() for every multi-stage test, but the lease-proxy step is only injected when LeaseClientEnabled is true. That leaves multi-stage steps with an unsatisfied dependency in jobs without a lease client and can fail graph construction. Please gate this requirement on lease-client availability (e.g., thread a flag into multiStageTestStep) or always add the lease-proxy step so the link is satisfiable.

🤖 Prompt for AI Agents
In `@pkg/steps/multi_stage/multi_stage.go` around lines 328 - 330, The code always
appends api.LeaseProxyServerLink() in the multi-stage step construction, which
creates an unsatisfied dependency when no lease client is present; modify the
multiStageTestStep construction to consult the lease-client availability (e.g.,
add or use a LeaseClientEnabled boolean on the multiStageTestStep struct) and
only append api.LeaseProxyServerLink() when that flag is true in the function
that currently does "ret = append(ret, api.LeaseProxyServerLink())" (or
alternatively ensure the lease-proxy step itself is always added so the link can
be satisfied); update any callers/constructors of multiStageTestStep to thread
the flag through.

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Feb 16, 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 b71c189 link true /test images
ci/prow/breaking-changes b71c189 link false /test breaking-changes
ci/prow/e2e b71c189 link true /test e2e
ci/prow/codegen b71c189 link true /test codegen

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