Skip to content

Revert "TRT-2817: Revert "Merge pull request #2279 from nbottari9/1814-duplicate-warning""#2322

Open
hongkailiu wants to merge 1 commit into
openshift:mainfrom
hongkailiu:revert-2320-revert-oc-2279
Open

Revert "TRT-2817: Revert "Merge pull request #2279 from nbottari9/1814-duplicate-warning""#2322
hongkailiu wants to merge 1 commit into
openshift:mainfrom
hongkailiu:revert-2320-revert-oc-2279

Conversation

@hongkailiu

@hongkailiu hongkailiu commented Jul 22, 2026

Copy link
Copy Markdown
Member

Reverts #2320

/hold

requires openshift/origin#31417 to go first.

Summary by CodeRabbit

  • New Features

    • Upgrade recommendations now account for whether the cluster version service evaluates update risks.
    • Client-side alert checks are skipped when risk handling is enabled for eligible self-managed clusters.
    • Error messages now clarify whether unresolved issues were identified by the cluster version service or locally.
  • Bug Fixes

    • Improved handling when risk-evaluation information is unavailable, preserving existing recommendation behavior.
  • Tests

    • Added coverage for feature-gate and hosted-cluster scenarios, including updated upgrade recommendation examples.

@openshift-merge-bot

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: LGTM mode

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jul 22, 2026
@openshift-ci openshift-ci Bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 22, 2026
@openshift-ci-robot

openshift-ci-robot commented Jul 22, 2026

Copy link
Copy Markdown

@hongkailiu: This pull request references TRT-2817 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the bug to target the "5.0.0" version, but no target version was set.

Details

In response to this:

Reverts #2320

/hold

requires openshift/origin#31417 to go first.

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci
openshift-ci Bot requested a review from ingvagabund July 22, 2026 23:11
@openshift-ci

openshift-ci Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hongkailiu

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 requested a review from tchap July 22, 2026 23:11
@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 22, 2026
@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Walkthrough

The upgrade recommendation flow now detects when CVO evaluates update risks, skips duplicate client-side alert checks when appropriate, loads FeatureGate and Infrastructure mock resources, and adds fixtures and expected outputs for CVO-handled and client-handled risk scenarios.

Changes

CVO alert handling

Layer / File(s) Summary
CVO alert evaluation decision
pkg/cli/admin/upgrade/recommend/alerts.go, pkg/cli/admin/upgrade/recommend/recommend.go, pkg/cli/admin/upgrade/recommend/alerts_test.go
Feature gates, cluster topology, and desired versions determine whether client-side alert evaluation is skipped; related helper tests cover enabled, disabled, version-mismatched, hosted, and non-hosted cases.
FeatureGate and Infrastructure mock inputs
pkg/cli/admin/upgrade/recommend/mockresources.go, pkg/cli/admin/upgrade/recommend/recommend.go
Mock data loads optional FeatureGate and Infrastructure manifests and derives their paths from mock ClusterVersion inputs.
CVO-handled risk fixtures
pkg/cli/admin/upgrade/recommend/examples/5.0.0-cvo-handling-risks-*
Examples model CVO-handled alerts, cluster version risks, feature gates, infrastructure, and expected command output.
Client-handled risk fixtures
pkg/cli/admin/upgrade/recommend/examples/5.0.0-cvo-not-handling-risks-*, pkg/cli/admin/upgrade/recommend/examples_test.go
Examples model client-side alert handling and expected output, with version mappings added to example tests.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Command
  participant AlertEvaluation
  participant FeatureGate
  participant Infrastructure
  participant ClusterVersion
  Command->>AlertEvaluation: evaluate alert ownership
  AlertEvaluation->>FeatureGate: read ClusterUpdateAcceptRisks
  AlertEvaluation->>Infrastructure: read cluster topology
  AlertEvaluation->>ClusterVersion: read desired version
  AlertEvaluation-->>Command: return skip or continue
Loading

Possibly related PRs

  • openshift/oc#2319: Adds the same CVO-aware alert evaluation, helper tests, mock loading, and fixtures.
  • openshift/oc#2320: Changes the same alertsEvaluatedByCVO feature-gate logic and related tests and fixtures.

Suggested reviewers: redhat-chai-bot

🚥 Pre-merge checks | ✅ 14 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (14 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes a revert of a prior revert and matches the PR’s stated intent.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed No Ginkgo-style titles were added; the modified tests use static Go test and t.Run names, with no dynamic or generated identifiers.
Test Structure And Quality ✅ Passed PASS: The changed tests are plain table-driven unit tests, not Ginkgo; no cluster resources, waits, or cleanup patterns are involved, and they follow existing fixture-test conventions.
Microshift Test Compatibility ✅ Passed No new Ginkgo e2e tests were added; the changed tests are plain Go unit tests, so the MicroShift check is not applicable.
Single Node Openshift (Sno) Test Compatibility ✅ Passed No new Ginkgo e2e tests were added; the touched tests are plain Go unit tests, and no It/Describe/Context/When specs or SNO-sensitive cluster assumptions appear.
Topology-Aware Scheduling Compatibility ✅ Passed Changes are limited to upgrade-recommend alert logic/tests and example fixtures; no pod scheduling rules, node selectors, anti-affinity, spread constraints, or replica changes were added.
Ote Binary Stdout Contract ✅ Passed No main/init/TestMain/RunSpecs setup or top-level stdout writes were added; the only new log call is inside normal command execution, not process-level setup.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed The PR adds only Go unit tests/fixtures; no Ginkgo e2e tests, IPv4-only parsing, or live external network calls were introduced.
No-Weak-Crypto ✅ Passed Touched files add alert/update logic and fixtures only; no MD5/SHA1/DES/RC4/3DES/Blowfish/ECB, custom crypto, or secret/token comparisons were found.
Container-Privileges ✅ Passed Changed files are config fixtures and Go logic; no Pod/container manifests or privilege settings (privileged, hostNetwork, allowPrivilegeEscalation, SYS_ADMIN, root) were added.
No-Sensitive-Data-In-Logs ✅ Passed The only new log is a generic warning on CVO-detection failure; it prints only the error and no code logs secrets, PII, hostnames, or tokens.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

🔧 Checkov (3.3.8)
pkg/cli/admin/upgrade/recommend/examples/5.0.0-cvo-handling-risks-alerts.json

Traceback (most recent call last):
File "/usr/local/bin/checkov", line 2, in
from checkov.main import Checkov
ModuleNotFoundError: No module named 'checkov'

pkg/cli/admin/upgrade/recommend/examples/5.0.0-cvo-handling-risks-cv.yaml

Traceback (most recent call last):
File "/usr/local/bin/checkov", line 2, in
from checkov.main import Checkov
ModuleNotFoundError: No module named 'checkov'

pkg/cli/admin/upgrade/recommend/examples/5.0.0-cvo-handling-risks-featuregate.yaml

Traceback (most recent call last):
File "/usr/local/bin/checkov", line 2, in
from checkov.main import Checkov
ModuleNotFoundError: No module named 'checkov'

  • 5 others

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

@hongkailiu

Copy link
Copy Markdown
Member Author

/payload-job-with-prs periodic-ci-openshift-release-main-ci-5.0-e2e-aws-ovn-techpreview-serial-2of3 #2320

@openshift-ci

openshift-ci Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

@hongkailiu: trigger 1 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command

  • periodic-ci-openshift-release-main-ci-5.0-e2e-aws-ovn-techpreview-serial-2of3

See details on https://pr-payload-tests.ci.openshift.org/runs/ci/160b6960-8623-11f1-80a8-fc7febfac843-0

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Nitpick comments (2)
pkg/cli/admin/upgrade/recommend/alerts.go (1)

311-313: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add the required function comments.

  • pkg/cli/admin/upgrade/recommend/alerts.go#L311-L313: document that isHostedCluster identifies external control-plane topology.
  • pkg/cli/admin/upgrade/recommend/alerts_test.go#L10-L10: document the feature-gate behavior under test.
  • pkg/cli/admin/upgrade/recommend/alerts_test.go#L97-L97: document the hosted-topology behavior under test.

As per coding guidelines, “Add descriptive comments to all exported and unexported Go types, functions, and methods.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/cli/admin/upgrade/recommend/alerts.go` around lines 311 - 313, Add a
descriptive comment above isHostedCluster stating that it identifies external
control-plane topology. In pkg/cli/admin/upgrade/recommend/alerts_test.go at
line 10, document the feature-gate behavior covered by the test; at line 97,
document the hosted-topology behavior covered by the test.

Source: Coding guidelines

pkg/cli/admin/upgrade/recommend/mockresources.go (1)

85-88: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Wrap fixture read errors with resource context.

Return errors identifying whether the failed file is the FeatureGate or Infrastructure fixture.

Proposed fix
- return err
+ return fmt.Errorf("read FeatureGate fixture %q: %w", o.featureGatePath, err)
...
- return err
+ return fmt.Errorf("read Infrastructure fixture %q: %w", o.infrastructurePath, err)

Also applies to: 103-106

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/cli/admin/upgrade/recommend/mockresources.go` around lines 85 - 88,
Update the fixture file reads in the resource-loading flow, including the
FeatureGate and Infrastructure paths, to wrap non-NotExist errors with context
identifying which fixture failed. Preserve the existing handling of missing
files and return the contextualized error from the relevant os.ReadFile call.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pkg/cli/admin/upgrade/recommend/alerts.go`:
- Around line 26-29: Correct the spelling in the warning message within the
alertsEvaluatedByCVO call handling, changing “occured” to “occurred” without
altering the surrounding control flow or logging behavior.

In
`@pkg/cli/admin/upgrade/recommend/examples/5.0.0-cvo-handling-risks.version-5.0.0-ec.3-output`:
- Line 10: Remove the stale ConditionalUpdateRisk error stanza from the
CVO-handled upgrade output fixture, leaving the expected output without a
client-side acceptance failure so it detects regressions to client-side risk
enforcement.

In `@pkg/cli/admin/upgrade/recommend/recommend.go`:
- Around line 341-347: The alertsEvaluatedByCVO lookup error is checked only
inside the true branch, so false-with-error results produce the wrong fallback
message. In the upgrade recommendation flow, check err immediately after calling
alertsEvaluatedByCVO and return a wrapped error using %w before branching on
cvoChecking; preserve the existing messages for successful true and false
results.
- Around line 114-115: Update the fixture-path setup around cvPath to remove the
trailing cvSuffix and append “-featuregate.yaml” and “-infrastructure.yaml” to
that filename stem, avoiding replacement of matching directory segments. In the
alertsEvaluatedByCVO flow, handle and return the lookup error immediately before
branching on cvoChecking, so failures are not hidden by the boolean condition.

---

Nitpick comments:
In `@pkg/cli/admin/upgrade/recommend/alerts.go`:
- Around line 311-313: Add a descriptive comment above isHostedCluster stating
that it identifies external control-plane topology. In
pkg/cli/admin/upgrade/recommend/alerts_test.go at line 10, document the
feature-gate behavior covered by the test; at line 97, document the
hosted-topology behavior covered by the test.

In `@pkg/cli/admin/upgrade/recommend/mockresources.go`:
- Around line 85-88: Update the fixture file reads in the resource-loading flow,
including the FeatureGate and Infrastructure paths, to wrap non-NotExist errors
with context identifying which fixture failed. Preserve the existing handling of
missing files and return the contextualized error from the relevant os.ReadFile
call.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 92cf37e0-1e14-432d-8379-e4fb6b60af2a

📥 Commits

Reviewing files that changed from the base of the PR and between 9946130 and 324c04c.

📒 Files selected for processing (19)
  • pkg/cli/admin/upgrade/recommend/alerts.go
  • pkg/cli/admin/upgrade/recommend/alerts_test.go
  • pkg/cli/admin/upgrade/recommend/examples/5.0.0-cvo-handling-risks-alerts.json
  • pkg/cli/admin/upgrade/recommend/examples/5.0.0-cvo-handling-risks-cv.yaml
  • pkg/cli/admin/upgrade/recommend/examples/5.0.0-cvo-handling-risks-featuregate.yaml
  • pkg/cli/admin/upgrade/recommend/examples/5.0.0-cvo-handling-risks-infrastructure.yaml
  • pkg/cli/admin/upgrade/recommend/examples/5.0.0-cvo-handling-risks.output
  • pkg/cli/admin/upgrade/recommend/examples/5.0.0-cvo-handling-risks.show-outdated-releases-output
  • pkg/cli/admin/upgrade/recommend/examples/5.0.0-cvo-handling-risks.version-5.0.0-ec.3-output
  • pkg/cli/admin/upgrade/recommend/examples/5.0.0-cvo-not-handling-risks-alerts.json
  • pkg/cli/admin/upgrade/recommend/examples/5.0.0-cvo-not-handling-risks-cv.yaml
  • pkg/cli/admin/upgrade/recommend/examples/5.0.0-cvo-not-handling-risks-featuregate.yaml
  • pkg/cli/admin/upgrade/recommend/examples/5.0.0-cvo-not-handling-risks-infrastructure.yaml
  • pkg/cli/admin/upgrade/recommend/examples/5.0.0-cvo-not-handling-risks.output
  • pkg/cli/admin/upgrade/recommend/examples/5.0.0-cvo-not-handling-risks.show-outdated-releases-output
  • pkg/cli/admin/upgrade/recommend/examples/5.0.0-cvo-not-handling-risks.version-5.0.0-ec.3-output
  • pkg/cli/admin/upgrade/recommend/examples_test.go
  • pkg/cli/admin/upgrade/recommend/mockresources.go
  • pkg/cli/admin/upgrade/recommend/recommend.go

Comment on lines +26 to +29
if skip, err := o.alertsEvaluatedByCVO(ctx); err != nil {
klog.Warningf("An error occured while determining if the CVO is evaluating alerts, so the client will check. %v", err)
} else if skip {
return nil, nil

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Correct the warning typo.

“occured” should be “occurred.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/cli/admin/upgrade/recommend/alerts.go` around lines 26 - 29, Correct the
spelling in the warning message within the alertsEvaluatedByCVO call handling,
changing “occured” to “occurred” without altering the surrounding control flow
or logging behavior.

Reason: TestAlert
Message: Test alert for updates. https://github.com/openshift/runbooks/tree/master/alerts?runbook=notfound

error: There are issues that apply to this cluster and have not been accepted. `oc adm upgrade accept` can be used to accept them: ConditionalUpdateRisk

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Remove the stale client-side acceptance failure.

Line 10 makes the CVO-handled scenario assert the ConditionalUpdateRisk rejection that this flow is intended to bypass. Remove the error stanza so this fixture detects a regression back to client-side risk enforcement.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@pkg/cli/admin/upgrade/recommend/examples/5.0.0-cvo-handling-risks.version-5.0.0-ec.3-output`
at line 10, Remove the stale ConditionalUpdateRisk error stanza from the
CVO-handled upgrade output fixture, leaving the expected output without a
client-side acceptance failure so it detects regressions to client-side risk
enforcement.

Comment on lines +114 to +115
o.mockData.featureGatePath = strings.Replace(o.mockData.cvPath, cvSuffix, "-featuregate.yaml", 1)
o.mockData.infrastructurePath = strings.Replace(o.mockData.cvPath, cvSuffix, "-infrastructure.yaml", 1)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

sed -n '1,220p' pkg/cli/admin/upgrade/recommend/recommend.go

Repository: openshift/oc

Length of output: 8070


🏁 Script executed:

grep -nR "cvPath\|featureGatePath\|infrastructurePath\|alertsEvaluatedByCVO" -n pkg/cli/admin/upgrade/recommend/recommend.go

Repository: openshift/oc

Length of output: 718


🏁 Script executed:

sed -n '320,380p' pkg/cli/admin/upgrade/recommend/recommend.go

Repository: openshift/oc

Length of output: 2974


🏁 Script executed:

sed -n '320,420p' pkg/cli/admin/upgrade/recommend/recommend.go

Repository: openshift/oc

Length of output: 4641


🏁 Script executed:

sed -n '420,520p' pkg/cli/admin/upgrade/recommend/recommend.go

Repository: openshift/oc

Length of output: 3305


🏁 Script executed:

grep -nn "alertsEvaluatedByCVO\|func (o .*alertsEvaluatedByCVO" -n pkg/cli/admin/upgrade/recommend/recommend.go && sed -n '380,460p' pkg/cli/admin/upgrade/recommend/recommend.go

Repository: openshift/oc

Length of output: 2992


🏁 Script executed:

sed -n '330,460p' pkg/cli/admin/upgrade/recommend/recommend.go

Repository: openshift/oc

Length of output: 5294


🏁 Script executed:

grep -n "func (o .*alertsEvaluatedByCVO\|alertsEvaluatedByCVO(ctx" -n pkg/cli/admin/upgrade/recommend/recommend.go && sed -n '460,560p' pkg/cli/admin/upgrade/recommend/recommend.go

Repository: openshift/oc

Length of output: 3449


🏁 Script executed:

python3 - <<'PY'
from pathlib import Path
p = Path('pkg/cli/admin/upgrade/recommend/recommend.go')
text = p.read_text()
for i, line in enumerate(text.splitlines(), 1):
    if 'alertsEvaluatedByCVO' in line:
        print(i, line)
PY

Repository: openshift/oc

Length of output: 226


🏁 Script executed:

rg -n "alertsEvaluatedByCVO" pkg/cli/admin/upgrade/recommend

Repository: openshift/oc

Length of output: 640


🏁 Script executed:

rg -n "func .*alertsEvaluatedByCVO|alertsEvaluatedByCVO\\(" pkg/cli/admin/upgrade/recommend

Repository: openshift/oc

Length of output: 497


🏁 Script executed:

sed -n '240,320p' pkg/cli/admin/upgrade/recommend/alerts.go

Repository: openshift/oc

Length of output: 2510


🏁 Script executed:

sed -n '1,120p' pkg/cli/admin/upgrade/recommend/alerts.go

Repository: openshift/oc

Length of output: 3785


🏁 Script executed:

sed -n '240,340p' pkg/cli/admin/upgrade/recommend/alerts.go

Repository: openshift/oc

Length of output: 2510


Derive the companion fixture paths from the filename suffix, and surface CVO lookup errors first. strings.Replace(..., 1) can rewrite a matching directory segment in cvPath, and alertsEvaluatedByCVO returns false, err on failure, so the nested err != nil check under cvoChecking never runs. Trim the trailing suffix before appending the companion names, and handle err before branching on cvoChecking.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/cli/admin/upgrade/recommend/recommend.go` around lines 114 - 115, Update
the fixture-path setup around cvPath to remove the trailing cvSuffix and append
“-featuregate.yaml” and “-infrastructure.yaml” to that filename stem, avoiding
replacement of matching directory segments. In the alertsEvaluatedByCVO flow,
handle and return the lookup error immediately before branching on cvoChecking,
so failures are not hidden by the boolean condition.

Comment on lines +341 to +347
if cvoChecking, err := o.alertsEvaluatedByCVO(ctx); cvoChecking {
if err != nil {
return fmt.Errorf("failed to determine if CVO is checking alerts: %v", err)
}
return fmt.Errorf("There are issues that apply to this cluster and have not been accepted. `oc adm upgrade accept` can be used to accept them: %s\n", strings.Join(sets.List(unaccepted), ","))
} else {
return fmt.Errorf("issues that apply to this cluster but which were not included in --accept: %s", strings.Join(sets.List(unaccepted), ","))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Handle the lookup error before branching.

alertsEvaluatedByCVO returns false, err, so Lines 342-344 are unreachable and the error falls through to the generic --accept message. Check err first and wrap it with %w, or explicitly adopt the same warning-and-fallback policy as alerts().

Proposed fix
- if cvoChecking, err := o.alertsEvaluatedByCVO(ctx); cvoChecking {
-     if err != nil {
-         return fmt.Errorf("failed to determine if CVO is checking alerts: %v", err)
-     }
+ cvoChecking, err := o.alertsEvaluatedByCVO(ctx)
+ if err != nil {
+     return fmt.Errorf("determining whether CVO checks alerts: %w", err)
+ }
+ if cvoChecking {
      return fmt.Errorf("There are issues that apply to this cluster and have not been accepted. `oc adm upgrade accept` can be used to accept them: %s\n", strings.Join(sets.List(unaccepted), ","))
- } else {
-     return fmt.Errorf("issues that apply to this cluster but which were not included in --accept: %s", strings.Join(sets.List(unaccepted), ","))
  }
+ return fmt.Errorf("issues that apply to this cluster but which were not included in --accept: %s", strings.Join(sets.List(unaccepted), ","))

As per path instructions, “Never ignore error returns.”

📝 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
if cvoChecking, err := o.alertsEvaluatedByCVO(ctx); cvoChecking {
if err != nil {
return fmt.Errorf("failed to determine if CVO is checking alerts: %v", err)
}
return fmt.Errorf("There are issues that apply to this cluster and have not been accepted. `oc adm upgrade accept` can be used to accept them: %s\n", strings.Join(sets.List(unaccepted), ","))
} else {
return fmt.Errorf("issues that apply to this cluster but which were not included in --accept: %s", strings.Join(sets.List(unaccepted), ","))
cvoChecking, err := o.alertsEvaluatedByCVO(ctx)
if err != nil {
return fmt.Errorf("determining whether CVO checks alerts: %w", err)
}
if cvoChecking {
return fmt.Errorf("There are issues that apply to this cluster and have not been accepted. `oc adm upgrade accept` can be used to accept them: %s\n", strings.Join(sets.List(unaccepted), ","))
} else {
return fmt.Errorf("issues that apply to this cluster but which were not included in --accept: %s", strings.Join(sets.List(unaccepted), ","))
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/cli/admin/upgrade/recommend/recommend.go` around lines 341 - 347, The
alertsEvaluatedByCVO lookup error is checked only inside the true branch, so
false-with-error results produce the wrong fallback message. In the upgrade
recommendation flow, check err immediately after calling alertsEvaluatedByCVO
and return a wrapped error using %w before branching on cvoChecking; preserve
the existing messages for successful true and false results.

Source: Path instructions

@hongkailiu

Copy link
Copy Markdown
Member Author

/payload-job-with-prs periodic-ci-openshift-release-main-ci-5.0-e2e-aws-ovn-techpreview-serial-2of3 openshift/origin#31417

@openshift-ci

openshift-ci Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

@hongkailiu: trigger 1 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command

  • periodic-ci-openshift-release-main-ci-5.0-e2e-aws-ovn-techpreview-serial-2of3

See details on https://pr-payload-tests.ci.openshift.org/runs/ci/31da0c00-8682-11f1-9066-6af507414644-0

@openshift-ci

openshift-ci Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

@hongkailiu: This PR was included in a payload test run from openshift/origin#31417
trigger 1 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command

  • periodic-ci-openshift-release-main-ci-5.0-e2e-aws-ovn-techpreview-serial-2of3

See details on https://pr-payload-tests.ci.openshift.org/runs/ci/e347f500-869c-11f1-8fbe-6e680a895c06-0

@hongkailiu

Copy link
Copy Markdown
Member Author

/pipeline auto

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Pipeline controller notification

The pipeline-auto label has been added to this PR. Second-stage tests will be triggered automatically when all first-stage tests pass.

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Scheduling required tests:
/test e2e-agnostic-ovn-cmd
/test e2e-aws-ovn
/test e2e-aws-ovn-serial-1of2
/test e2e-aws-ovn-serial-2of2
/test e2e-aws-ovn-upgrade

@hongkailiu

Copy link
Copy Markdown
Member Author

/test e2e-aws-ovn-serial-2of2

@hongkailiu

Copy link
Copy Markdown
Member Author

/payload-job periodic-ci-openshift-release-main-ci-5.0-e2e-aws-ovn-techpreview-serial-2of3

Expecting a failure.

but after openshift/origin#31417 gets in, expecting a success.

@openshift-ci

openshift-ci Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

@hongkailiu: trigger 1 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command

  • periodic-ci-openshift-release-main-ci-5.0-e2e-aws-ovn-techpreview-serial-2of3

See details on https://pr-payload-tests.ci.openshift.org/runs/ci/0b9dd0c0-86c4-11f1-8028-419d584ec89f-0

@openshift-ci

openshift-ci Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

@hongkailiu: 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/e2e-aws-ovn-serial-2of2 324c04c link true /test e2e-aws-ovn-serial-2of2

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. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. pipeline-auto

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants