Skip to content

Revert: Fix APIs for openshift.io must have stable versions check - #31468

Merged
sdodson merged 1 commit into
openshift:mainfrom
sadasu:fix-crd-check
Jul 31, 2026
Merged

Revert: Fix APIs for openshift.io must have stable versions check#31468
sdodson merged 1 commit into
openshift:mainfrom
sadasu:fix-crd-check

Conversation

@sadasu

@sadasu sadasu commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

After an API has stabilized to version v1, then o/api wants the earlier v1alpha1 version to be removed irrespective of the version's served value.

So, reverting back to the original way this test was implemented.

Reverting change introduced by #31458

Summary by CodeRabbit

  • Bug Fixes
    • Updated CRD stability validation to ignore versions that are not served, ensuring checks focus only on active CRD versions.

After an API has stabilized to version v1, then o/api wants the
earlier v1alpha1 version to be removed irrespective of the
version's `served` value.

So, reverting back to the original way this test was implemented.
@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: automatic mode

@openshift-ci
openshift-ci Bot requested review from bparees and sdodson July 31, 2026 21:02
@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Walkthrough

The CRD stability test now skips unserved versions before it validates version stability.

Changes

CRD stability validation

Layer / File(s) Summary
Filter unserved CRD versions
test/extended/operators/crd_must_be_stable.go
The test skips CRD versions where versionSpec.Served is false.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

Suggested labels: jira/valid-bug, ready-for-human-review

🚥 Pre-merge checks | ✅ 14 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Test Structure And Quality ⚠️ Warning The single It block has no resource or wait issues, but lines 69 and 77 use bare error assertions without meaningful failure messages. Add context to both assertions, such as identifying the FeatureGates or CustomResourceDefinitions API operation that failed.
✅ 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 clearly identifies that the pull request reverts the stable-version check for openshift.io APIs.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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 The PR only adds a Served-version guard. The existing Ginkgo titles are static literals and contain no runtime identifiers, timestamps, nodes, namespaces, IPs, or UUIDs.
Microshift Test Compatibility ✅ Passed The PR adds only a Served-version filter to an existing Ginkgo test; it adds no new It/Describe/Context test or MicroShift-incompatible API reference.
Single Node Openshift (Sno) Test Compatibility ✅ Passed The commit only adds a Served-version guard to an existing CRD stability test; it adds no new Ginkgo test and makes no multi-node or HA assumptions.
Topology-Aware Scheduling Compatibility ✅ Passed The pull request changes only CRD version validation in a test file; it adds no deployments, operators, controllers, replicas, affinities, selectors, tolerations, or other scheduling constraints.
Ote Binary Stdout Contract ✅ Passed The PR only adds a Served check inside the It body. It adds no process-level stdout writes, logging configuration, or Ginkgo suite setup output.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed The patch only adds a Served check to an existing CRD stability test; it adds no Ginkgo test, IPv4 assumption, or external connectivity.
No-Weak-Crypto ✅ Passed The PR adds only a Served-version guard in a CRD stability test. It adds no weak-crypto algorithms, crypto APIs, custom crypto, or secret/token comparisons.
Container-Privileges ✅ Passed The commit changes only one Go test and adds a Served check; it adds no container or Kubernetes manifest privilege settings.
No-Sensitive-Data-In-Logs ✅ Passed The 4-line change only skips unserved CRD versions; it adds no logging or sensitive-data fields. Existing failure output contains only CRD and version names.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@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: 1

🤖 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 `@test/extended/operators/crd_must_be_stable.go`:
- Around line 92-95: Remove the versionSpec.Served guard in the stability
validation loop so unserved versions are still checked once the API includes v1.
Add regression coverage pairing an unserved v1alpha1 with v1, then run make
verify and make check.
🪄 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: 069ee03c-d4a0-445a-af3c-bd2b841afeae

📥 Commits

Reviewing files that changed from the base of the PR and between 8d9dbe3 and 1761bfa.

📒 Files selected for processing (1)
  • test/extended/operators/crd_must_be_stable.go

Comment on lines +92 to +95
if !versionSpec.Served {
continue
}

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

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- file outline ---'
ast-grep outline test/extended/operators/crd_must_be_stable.go --view expanded
printf '%s\n' '--- relevant implementation ---'
sed -n '1,180p' test/extended/operators/crd_must_be_stable.go
printf '%s\n' '--- related symbols and tests ---'
rg -n --glob '*.go' 'legacyCRDSsWithUnstableVersions|stableVersions|crd_must_be_stable|MustBeStable|Served' test/extended
printf '%s\n' '--- tracked files in the area ---'
git ls-files test/extended/operators | sed -n '1,120p'
printf '%s\n' '--- concise diff summary ---'
git diff --stat

Repository: openshift/origin

Length of output: 8215


🏁 Script executed:

#!/bin/bash
set -e
python3 - <<'PY'
from pathlib import Path
p = Path("test/extended/operators/crd_must_be_stable.go")
text = p.read_text()
print("--- focused control-flow excerpt ---")
for i, line in enumerate(text.splitlines(), 1):
    if 70 <= i <= 125:
        print(f"{i:4}: {line}")
print("--- all version checks ---")
for i, line in enumerate(text.splitlines(), 1):
    if "versionSpec" in line or "stableVersions" in line:
        print(f"{i:4}: {line}")
PY
printf '%s\n' '--- test package registration and nearby tests ---'
sed -n '1,220p' test/extended/operators/operators.go 2>/dev/null || true
rg -n -C 8 --glob '*.go' 'CRD|CustomResourceDefinition|v1alpha1|v1beta1' test/extended/operators test/extended/include.go

Repository: openshift/origin

Length of output: 35566


🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- target file ---'
cat -n test/extended/operators/crd_must_be_stable.go | sed -n '1,150p'
printf '%s\n' '--- relevant repository references ---'
rg -n -C 6 --glob '*.go' 'legacyCRDSsWithUnstableVersions|stableVersions|versionSpec\.Served|crd_must_be_stable' .
printf '%s\n' '--- operator test files ---'
git ls-files 'test/extended/operators/**' | sed -n '1,160p'

Repository: openshift/origin

Length of output: 12353


🏁 Script executed:

#!/bin/bash
set -e
cat -n test/extended/operators/crd_must_be_stable.go | sed -n '1,150p'
rg -n -C 6 --glob '*.go' 'legacyCRDSsWithUnstableVersions|stableVersions|versionSpec\.Served|crd_must_be_stable' .
git ls-files 'test/extended/operators/**' | sed -n '1,160p'

Repository: openshift/origin

Length of output: 12266


🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- repository state and commit context ---'
git status --short
git branch --show-current
git log -5 --oneline -- test/extended/operators/crd_must_be_stable.go
printf '%s\n' '--- CRD version declarations in source/manifests ---'
rg -n --glob '*.{yaml,yml,json,go}' 'served:\s*(true|false)|name:\s*v1(alpha|beta)' . | sed -n '1,240p'
printf '%s\n' '--- include registration ---'
rg -n 'operators' test/extended/include.go test/extended --glob 'include.go'
printf '%s\n' '--- standalone behavior probe ---'
python3 - <<'PY'
stable = {"v1", "v2", "v3", "v4", "v5"}
legacy = {("example.openshift.io", "v1alpha1")}
cases = [
    ("new.openshift.io", "v1alpha1", False),
    ("new.openshift.io", "v1alpha1", True),
    ("new.openshift.io", "v1", False),
    ("example.openshift.io", "v1alpha1", False),
]
for name, version, served in cases:
    skipped_legacy = (name, version) in legacy
    old_result = "failure" if (not skipped_legacy and served and version not in stable) else "pass"
    proposed_without_served_guard = "failure" if (not skipped_legacy and version not in stable) else "pass"
    print(f"{name} {version} served={served}: current={old_result}, without_guard={proposed_without_served_guard}")
PY

Repository: openshift/origin

Length of output: 22135


🏁 Script executed:

#!/bin/bash
set -e
git status --short
git branch --show-current
git log -5 --oneline -- test/extended/operators/crd_must_be_stable.go
rg -n --glob '*.{yaml,yml,json,go}' 'served:\s*(true|false)|name:\s*v1(alpha|beta)' . | sed -n '1,240p'
rg -n 'operators' test/extended/include.go test/extended --glob 'include.go'
python3 - <<'PY'
stable = {"v1", "v2", "v3", "v4", "v5"}
legacy = {("example.openshift.io", "v1alpha1")}
for name, version, served in [
    ("new.openshift.io", "v1alpha1", False),
    ("new.openshift.io", "v1alpha1", True),
    ("new.openshift.io", "v1", False),
    ("example.openshift.io", "v1alpha1", False),
]:
    exempt = (name, version) in legacy
    current = "failure" if not exempt and served and version not in stable else "pass"
    without_guard = "failure" if not exempt and version not in stable else "pass"
    print(f"{name} {version} served={served}: current={current}, without_guard={without_guard}")
PY

Repository: openshift/origin

Length of output: 21975


🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- revert commit ---'
git show --format=fuller --stat 1761bfa5c9
git show --format= --unified=25 1761bfa5c9 -- test/extended/operators/crd_must_be_stable.go
printf '%s\n' '--- preceding implementation change ---'
git show --format=fuller --stat 5b828df7f1
git show --format= --unified=20 5b828df7f1 -- test/extended/operators/crd_must_be_stable.go
printf '%s\n' '--- commit ancestry for the target file ---'
git log --oneline --follow -- test/extended/operators/crd_must_be_stable.go | sed -n '1,30p'

Repository: openshift/origin

Length of output: 8005


🏁 Script executed:

#!/bin/bash
set -e
git show --format=fuller --stat 1761bfa5c9
git show --format= --unified=25 1761bfa5c9 -- test/extended/operators/crd_must_be_stable.go
git show --format=fuller --stat 5b828df7f1
git show --format= --unified=20 5b828df7f1 -- test/extended/operators/crd_must_be_stable.go
git log --oneline --follow -- test/extended/operators/crd_must_be_stable.go | sed -n '1,30p'

Repository: openshift/origin

Length of output: 7899


Do not skip unserved unstable versions.

The stability requirement applies after an API reaches v1, regardless of served. Remove this guard. Add regression coverage for an unserved v1alpha1 alongside v1.

Proposed fix
-					if !versionSpec.Served {
-						continue
-					}
-

Run make verify and make check after the change.

📝 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 !versionSpec.Served {
continue
}
🤖 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 `@test/extended/operators/crd_must_be_stable.go` around lines 92 - 95, Remove
the versionSpec.Served guard in the stability validation loop so unserved
versions are still checked once the API includes v1. Add regression coverage
pairing an unserved v1alpha1 with v1, then run make verify and make check.

Source: Coding guidelines

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Scheduling required tests:
/test e2e-aws-csi
/test e2e-aws-ovn-fips
/test e2e-aws-ovn-microshift
/test e2e-aws-ovn-microshift-serial
/test e2e-aws-ovn-serial-1of2
/test e2e-aws-ovn-serial-2of2
/test e2e-gcp-csi
/test e2e-gcp-ovn
/test e2e-gcp-ovn-upgrade
/test e2e-metal-ipi-ovn-ipv6
/test e2e-vsphere-ovn
/test e2e-vsphere-ovn-upi

@sdodson

sdodson commented Jul 31, 2026

Copy link
Copy Markdown
Member

/lgtm
/Approved
/Verified by CI

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Jul 31, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@sdodson: This PR has been marked as verified by CI.

Details

In response to this:

/lgtm
/Approved
/Verified by CI

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 added the lgtm Indicates that a PR is ready to be merged. label Jul 31, 2026
@openshift-ci

openshift-ci Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: sadasu, sdodson

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 Jul 31, 2026
@sdodson
sdodson merged commit e3c4a6b into openshift:main Jul 31, 2026
9 of 22 checks passed
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. verified Signifies that the PR passed pre-merge verification criteria

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants