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

OCP5 enablement in ci-tools

Open jmguzik opened this issue 1 month ago • 4 comments

This change prepares ci-tools for OpenShift 5.x support while maintaining backward compatibility with 4.x. It also generalizes version handling to support future major versions (6.x through 9.x).

Key changes:

Version Transition Logic (pkg/api/version.go):

  • Added VersionTransitionOverrides map as single source of truth for cross-major version transitions (e.g., 5.0 -> 4.22)
  • Added GetPreviousVersion and GetPreviousVersionSimple functions
  • Handles the fact that 4.0 never existed (4.1 was the first 4.x release)

Updated Components:

  • pkg/api/ocplifecycle: GetPastVersion/GetPastPastVersion now use centralized version logic
  • pkg/jobrunaggregator: pass_fail.go and util.go use new version functions
  • pkg/rehearse/jobs.go: Generalized relevancy for major versions 4-9
  • pkg/release/prerelease: Dynamic stream derivation from version bounds, added StableLatestMajorMinor for any stream
  • pkg/steps/release/promote.go: Tries stable streams 9 down to 4

CLI Tools Updated:

  • cmd/cvp-trigger: Validates versions >= 4.x (not just 4.x)
  • cmd/registry-replacer: Added --current-release-major flag
  • cmd/ocp-build-data-enforcer: Added --major flag

The repository is now ready for OpenShift versions 4.x through 9.x.

jmguzik avatar Jan 14 '26 13:01 jmguzik

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 14 '26 13:01 openshift-ci-robot

Walkthrough

Introduce a centralized version utility (parsing, validation, previous-version resolution), propagate it across CLIs and internal packages to support multi-major releases (4.x and 5.x+), expand tests, and update callers to use API-driven version checks and explicit past/past-past version handling with error propagation.

Changes

Cohort / File(s) Summary
Version utilities & tests
pkg/api/version.go, pkg/api/version_test.go, pkg/api/zz_generated.deepcopy.go
Add ParsedVersion, parsing/validation (ParseVersion, IsValidOCPVersion), previous-version resolution (GetPreviousVersion*, GetPreviousVersionSimple), a transition override map, comprehensive unit tests, and deepcopy methods for ParsedVersion.
Branch/version detection (tide & tests)
cmd/branchingconfigmanagers/tide-config-manager/main.go, cmd/branchingconfigmanagers/tide-config-manager/main_test.go
Replace hard-coded release-4.*/openshift-4.* checks with prefix+api.IsValidOCPVersion validation; update/extend tests to include 5.x cases.
CLI validators & flags
cmd/cvp-trigger/main.go, cmd/ci-operator-config-mirror/main.go, cmd/ocp-build-data-enforcer/main.go, cmd/registry-replacer/main.go
Replace ad-hoc string checks with api.IsValidOCPVersion; remove unused imports; add/change flags (--major, --current-release-major) and adjust validation/error handling where required.
API: leases & tests
pkg/api/leases.go, pkg/api/leases_test.go
Introduce parseVersionFromBranch, centralize branch version parsing, enforce minimum IP-pool rules (4.16+ for 4.x; 5.x+ allowed), and add AWS 5.x test cases.
API: metadata & tests
pkg/api/metadata.go, pkg/api/metadata_test.go
Broaden branch regex from 4.x-only to 4.x and later; update FlavorForBranch and tests to map 5.x branches correctly.
OCP lifecycle
pkg/api/ocplifecycle/ocplifecycle.go
Change GetPastVersion/GetPastPastVersion to return (string, error) and use api.GetPreviousVersionSimple; switch some usages to api. types and propagate errors.
Job aggregator changes
pkg/jobrunaggregator/jobrunaggregatoranalyzer/pass_fail.go, pkg/jobrunaggregator/jobrunhistoricaldataanalyzer/util.go
Remove 4.x-only string parsing; use api.ParseVersion/GetPreviousVersionSimple/GetPreviousVersion for fallback resolution; sort parsed versions and add error handling for missing/invalid releases.
Rehearse relevancy logic
pkg/rehearse/jobs.go
Replace fixed 4.x relevancy map with computed relevancy across configurable major/minor ranges and update relevancy assignment logic.
Release prerelease client
pkg/release/prerelease/client.go
Replace Stable4LatestMajorMinor with StableLatestMajorMinor(client, stream), add deriveStreamFromBounds to choose stream from bounds, and adjust endpoint construction.
Release promotion
pkg/steps/release/promote.go
Add getLatestStableCLIVersion helper to iterate streams (9-stable→4-stable) and update default CLI fallback; note duplicate helper definitions present in file to remove.
Frequency reducer & branching config manager tweaks
cmd/branchingconfigmanagers/frequency-reducer/main.go, cmd/branchingconfigmanagers/tide-config-manager/main.go
Read explicit pastVersion/pastPastVersion with error handling at start of flows and compare using returned strings rather than calling version methods inline.
Autogenerated deepcopy updates
pkg/api/zz_generated.deepcopy.go
Add deepcopy functions for ParsedVersion to support safe copying of the new type.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~75 minutes

✨ Finishing touches
  • [ ] 📝 Generate docstrings

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

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

Scheduling required tests: /test e2e

Scheduling tests matching the pipeline_run_if_changed or not excluded by pipeline_skip_if_only_changed parameters: /test integration-optional-test

openshift-ci-robot avatar Jan 21 '26 13:01 openshift-ci-robot

@jmguzik: 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/breaking-changes 2cf603b3560fdd596663981d128963c1ae7fe795 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 22 '26 13:01 openshift-ci[bot]

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jmguzik, Prucek

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 27 '26 08:01 openshift-ci[bot]

/retest-required

Remaining retests: 0 against base HEAD 7a570dfadea5ee16c95433843b07e43008df5193 and 2 for PR HEAD 2cf603b3560fdd596663981d128963c1ae7fe795 in total

openshift-ci-robot avatar Jan 27 '26 08:01 openshift-ci-robot

/test e2e

jmguzik avatar Jan 27 '26 12:01 jmguzik

Changes for pass_fail lgtm, :bow:

neisw avatar Jan 27 '26 12:01 neisw