Skip to content

USHIFT-6718: major version changes for test framework#6372

Open
pacevedom wants to merge 1 commit intoopenshift:mainfrom
pacevedom:test-framework-5.0
Open

USHIFT-6718: major version changes for test framework#6372
pacevedom wants to merge 1 commit intoopenshift:mainfrom
pacevedom:test-framework-5.0

Conversation

@pacevedom
Copy link
Contributor

No description provided.

@coderabbitai
Copy link

coderabbitai bot commented Mar 18, 2026

Walkthrough

Derive OpenShift major and minor from version sources and propagate them across scripts, templates, and tests; replace hardcoded 4.* repository names and openshift-v4 mirror paths with dynamic {major}.{minor} and openshift-v{major} forms; adjust validations and function signatures accordingly.

Changes

Cohort / File(s) Summary
Build & devenv scripts
scripts/devenv-builder/configure-vm.sh, scripts/get-latest-rhocp-repo.sh
Parse OCP major (and minor) from MAKE_VERSION/Makefile, use rhocp-{major}.{minor} repo IDs and openshift-v{major} mirror paths; relax numeric regex to 1–2 digits; clamp minor arithmetic to non-negative.
Release-notes tooling
scripts/release-notes/gen_gh_releases_from_mirror.py, scripts/release-notes/gen_gh_releases_from_rhocp.py
Add per-major mirror URL builder (get_mirror_url_base), group scans by major, and make RPM repo/name and repo stanzas major-aware when generating links and repo entries.
Version generation — Python
test/bin/pyutils/generate_common_versions.py
Add VERSION_MAP and get_previous_version(major,minor); change many APIs to accept (major,minor); compute previous/Y‑2 across major boundaries; add --major CLI arg; emit major fields into templates and major-aware URLs/repos.
Version generation — Shell & helpers
test/bin/common_versions.sh, test/assets/common_versions.sh.template, test/bin/build_rpms.sh, test/bin/common.sh, test/bin/pyutils/build_bootc_images.py, test/bin/pyutils/build_bootc_images.py
Introduce/export MAJOR_VERSION, PREVIOUS_MAJOR_VERSION, YMINUS2_MAJOR_VERSION and RHOCP_MAJOR_Y* vars; update Brew download coordinates, repo probes, beta URL builders and branch names to use ${MAJOR_VERSION}.${MINOR_VERSION} and major-aware repo IDs.
Kickstart & rpm post-install
test/kickstart-templates/includes/post-cos9rpm.cfg, test/bin/scenario.sh
Split placeholders into OCPMAJOR/OCPMINOR, compute OCPVERSION="${OCPMAJOR}.${OCPMINOR}", substitute MAJOR_VERSION in kickstart rendering, and use openshift-v${OCPMAJOR} baseurls.
Test package sources (templates)
test/package-sources/rhocp-y.toml, test/package-sources/rhocp-y1.toml, test/package-sources/rhocp-y2.toml
Change template name and CDN url to use {{ .Env.RHOCP_MAJOR_Y* }}.{{ .Env.RHOCP_MINOR_Y* }} and /rhocp/<major>.<minor>/os paths instead of hardcoded 4.<minor>.
Test scenarios & scripts
test/scenarios/presubmits/el98-src@rpm-install.sh.disabled, test/scenarios/releases/el98@rpm-standard1.sh.disabled, test/scenarios/releases/el98@rpm-standard2.sh.disabled, test/scenarios/releases/el98@rpm-upgrade.sh.disabled
Change configure_rhocp_repo() signatures to accept major and minor separately; update numeric detection, repo id/name generation for numeric and beta cases, and call sites to pass major+minor pairs.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 18, 2026
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 18, 2026

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@pacevedom
Copy link
Contributor Author

/test ?

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 18, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: pacevedom

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 Mar 18, 2026
@pacevedom
Copy link
Contributor Author

/test e2e-aws-tests

@pacevedom
Copy link
Contributor Author

/test e2e-aws-tests
/test e2e-aws-tests-bootc

@pacevedom
Copy link
Contributor Author

/test e2e-aws-testes

@pacevedom
Copy link
Contributor Author

/test e2e-aws-tests
/test e2e-aws-tests-arm

@pacevedom pacevedom changed the title WIP major version changes for test framework USHIFT-6718: major version changes for test framework Mar 20, 2026
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Mar 20, 2026
@openshift-ci-robot
Copy link

openshift-ci-robot commented Mar 20, 2026

@pacevedom: This pull request references USHIFT-6718 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 story to target the "4.22.0" version, but no target version was set.

Details

In response to this:

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.

@pacevedom
Copy link
Contributor Author

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Mar 20, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@scripts/devenv-builder/configure-vm.sh`:
- Around line 279-282: The OCP_MAJOR/OCP_MINOR extraction is using cut on the
file path ${MAKE_VERSION} instead of the value read from the file; change it to
follow the pattern used at line 197 by first extracting MAKE_VERSION from the
file using grep + cut -d'=' -f2 (trimming whitespace), then parse that value
with cut -d'.' -f1 and -f2 to set OCP_MAJOR and OCP_MINOR, set
OCPVERSION="${OCP_MAJOR}.${OCP_MINOR}", and keep OCC_SRC construction the same;
update the variable names (MAKE_VERSION, OCP_MAJOR, OCP_MINOR, OCPVERSION,
OCC_SRC) where they are assigned so you parse the actual version string rather
than the file path.

In `@scripts/get-latest-rhocp-repo.sh`:
- Around line 47-48: The calculation of stop from current_minor can produce a
negative value which later generates invalid repo names; update the logic around
variables current_minor and stop so stop is clamped to a minimum of 0 before the
repo scan loop (the variable used in the for/seq loop around the lines that
iterate over minor versions). Locate the assignment to stop and replace it with
a safe clamp (e.g., set stop to 0 when current_minor - 3 is negative) so
subsequent checks that build repo URLs using current_minor and stop cannot
produce negative minors.

In `@scripts/release-notes/gen_gh_releases_from_mirror.py`:
- Around line 172-182: The code hardcodes url_base_aarch64 and url_base_x86
using the current branch major and then scans all versions with those bases,
which breaks when versions_to_scan contains a different major; update the calls
to find_new_releases so the mirror URL base is computed per version: for each
version in versions_to_scan determine its major (e.g., parse version -> major)
and call get_mirror_url_base(major_for_version, 'aarch64') and
get_mirror_url_base(major_for_version, 'x86_64') and then pass those per-version
url bases into find_new_releases (when invoking from the blocks that use args.ec
and args.rc) so each scanned version queries the correct openshift-v{major}
tree.

In `@test/bin/pyutils/generate_common_versions.py`:
- Around line 284-287: get_gitops_version() currently assumes compatibility with
major 4 and only decrements the minor, which breaks when
generate_common_versions() computes cross-major Y-1/Y-2 (e.g., --major 5 --minor
0). Update get_gitops_version() to be major-aware: accept or derive both major
and minor, and when probing fallback versions iterate using
get_previous_version(major, minor) (or the same logic used in
generate_common_versions) to step to previous minor/major pairs instead of just
decrementing minor; ensure the same change is applied for the other lookup block
referenced around lines 335-337 so all GITOPS_VERSION lookups use the
cross-major-aware fallback sequence.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: f0660fe4-2926-4a4e-aede-d055b2097a60

📥 Commits

Reviewing files that changed from the base of the PR and between 8a16d85 and 3c69948.

📒 Files selected for processing (19)
  • scripts/devenv-builder/configure-vm.sh
  • scripts/get-latest-rhocp-repo.sh
  • scripts/release-notes/gen_gh_releases_from_mirror.py
  • scripts/release-notes/gen_gh_releases_from_rhocp.py
  • test/assets/common_versions.sh.template
  • test/bin/build_rpms.sh
  • test/bin/common.sh
  • test/bin/common_versions.sh
  • test/bin/pyutils/build_bootc_images.py
  • test/bin/pyutils/generate_common_versions.py
  • test/bin/scenario.sh
  • test/kickstart-templates/includes/post-cos9rpm.cfg
  • test/package-sources/rhocp-y.toml
  • test/package-sources/rhocp-y1.toml
  • test/package-sources/rhocp-y2.toml
  • test/scenarios/presubmits/el98-src@rpm-install.sh.disabled
  • test/scenarios/releases/el98@rpm-standard1.sh.disabled
  • test/scenarios/releases/el98@rpm-standard2.sh.disabled
  • test/scenarios/releases/el98@rpm-upgrade.sh.disabled

@pacevedom pacevedom force-pushed the test-framework-5.0 branch from 3c69948 to c6a53ad Compare March 20, 2026 13:00
@pacevedom
Copy link
Contributor Author

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Mar 20, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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.

♻️ Duplicate comments (1)
test/bin/pyutils/generate_common_versions.py (1)

275-285: ⚠️ Potential issue | 🟡 Minor

Add try/except for get_previous_version in gitops lookup.

If the loop iterates close to a major boundary (e.g., starting at 4.1), line 284 will raise KeyError when reaching 4.0's previous version.

Proposed fix
     for _ in range(4):
         for gitops_version_from_api_docs in data.get("data", [{}])[0].get("versions", []):
             gitops_version_ocp_compatibility = gitops_version_from_api_docs.get("openshift_compatibility") or ""
             gitops_version_number = gitops_version_from_api_docs.get("name")
             if f"{current_major}.{current_minor}" in gitops_version_ocp_compatibility:
                 logging.info(f"Latest GitOps version: {gitops_version_number} which is compatible with OCP {gitops_version_ocp_compatibility}")
                 return gitops_version_number
-        current_major, current_minor = get_previous_version(current_major, current_minor)
+        try:
+            current_major, current_minor = get_previous_version(current_major, current_minor)
+        except KeyError:
+            break
     return ""
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/bin/pyutils/generate_common_versions.py` around lines 275 - 285, The
loop that walks previous versions calls get_previous_version(current_major,
current_minor) without handling KeyError; wrap that call in a try/except
KeyError around the invocation in the loop in generate_common_versions.py, log
or handle the error (e.g., logging.warning and break or return an empty string)
and stop iterating when a KeyError occurs so the function returns "" instead of
raising; ensure you keep the existing behavior of returning
gitops_version_number when found and returning "" on failure.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@test/bin/pyutils/generate_common_versions.py`:
- Around line 275-285: The loop that walks previous versions calls
get_previous_version(current_major, current_minor) without handling KeyError;
wrap that call in a try/except KeyError around the invocation in the loop in
generate_common_versions.py, log or handle the error (e.g., logging.warning and
break or return an empty string) and stop iterating when a KeyError occurs so
the function returns "" instead of raising; ensure you keep the existing
behavior of returning gitops_version_number when found and returning "" on
failure.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: acadad9a-5a8a-46d3-b64b-fc8a9cf12de9

📥 Commits

Reviewing files that changed from the base of the PR and between 3c69948 and c6a53ad.

📒 Files selected for processing (19)
  • scripts/devenv-builder/configure-vm.sh
  • scripts/get-latest-rhocp-repo.sh
  • scripts/release-notes/gen_gh_releases_from_mirror.py
  • scripts/release-notes/gen_gh_releases_from_rhocp.py
  • test/assets/common_versions.sh.template
  • test/bin/build_rpms.sh
  • test/bin/common.sh
  • test/bin/common_versions.sh
  • test/bin/pyutils/build_bootc_images.py
  • test/bin/pyutils/generate_common_versions.py
  • test/bin/scenario.sh
  • test/kickstart-templates/includes/post-cos9rpm.cfg
  • test/package-sources/rhocp-y.toml
  • test/package-sources/rhocp-y1.toml
  • test/package-sources/rhocp-y2.toml
  • test/scenarios/presubmits/el98-src@rpm-install.sh.disabled
  • test/scenarios/releases/el98@rpm-standard1.sh.disabled
  • test/scenarios/releases/el98@rpm-standard2.sh.disabled
  • test/scenarios/releases/el98@rpm-upgrade.sh.disabled
✅ Files skipped from review due to trivial changes (4)
  • test/bin/common.sh
  • test/bin/build_rpms.sh
  • test/package-sources/rhocp-y2.toml
  • test/package-sources/rhocp-y1.toml
🚧 Files skipped from review as they are similar to previous changes (8)

@pacevedom
Copy link
Contributor Author

/test e2e-aws-tests
/test e2e-aws-tests-arm
/test e2e-aws-tests-bootc-el9
/test e2e-aws-tests-bootc-arm-el9

@pacevedom pacevedom marked this pull request as ready for review March 23, 2026 12:55
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 23, 2026
@openshift-ci openshift-ci bot requested review from jogeo and vanhalenar March 23, 2026 12:56
@pacevedom
Copy link
Contributor Author

/hold

@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 Mar 23, 2026
@pacevedom pacevedom force-pushed the test-framework-5.0 branch from c6a53ad to 2db639e Compare March 23, 2026 13:29
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.

♻️ Duplicate comments (1)
test/bin/pyutils/generate_common_versions.py (1)

275-285: ⚠️ Potential issue | 🟠 Major

Unhandled KeyError can crash the script.

get_previous_version() raises KeyError when stepping past defined majors, but this call (line 284) isn't wrapped in try/except like get_dependencies_repo_url (lines 113-116). If the loop exhausts VERSION_MAP, the script crashes.

Proposed fix
     current_major, current_minor = major_version, minor_version
     for _ in range(4):
         for gitops_version_from_api_docs in data.get("data", [{}])[0].get("versions", []):
             gitops_version_ocp_compatibility = gitops_version_from_api_docs.get("openshift_compatibility") or ""
             gitops_version_number = gitops_version_from_api_docs.get("name")
             if f"{current_major}.{current_minor}" in gitops_version_ocp_compatibility:
                 logging.info(f"Latest GitOps version: {gitops_version_number} which is compatible with OCP {gitops_version_ocp_compatibility}")
                 return gitops_version_number
-        current_major, current_minor = get_previous_version(current_major, current_minor)
+        try:
+            current_major, current_minor = get_previous_version(current_major, current_minor)
+        except KeyError:
+            break
     return ""
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/bin/pyutils/generate_common_versions.py` around lines 275 - 285, The
loop in the version-selection logic can crash because
get_previous_version(current_major, current_minor) may raise KeyError when
versions are exhausted; wrap that call in a try/except KeyError inside the
for-loop (the block using current_major/current_minor and
gitops_version_from_api_docs) and on KeyError break out (or return an empty
string) so the function safely falls through to the final return ""; ensure you
update references to current_major/current_minor only when the call succeeds and
preserve existing logging/return behavior for gitops_version_number.
🧹 Nitpick comments (1)
test/scenarios/presubmits/el98-src@rpm-install.sh.disabled (1)

44-72: Extract configure_rhocp_repo() into a shared helper.

This exact repo-setup logic now lives here and in test/scenarios/releases/el98@rpm-standard1.sh.disabled and test/scenarios/releases/el98@rpm-standard2.sh.disabled. The next repo-format change will be easy to miss in one copy again.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/scenarios/presubmits/el98-src`@rpm-install.sh.disabled around lines 44 -
72, Extract the configure_rhocp_repo function into a shared helper script and
replace the duplicated copies with calls to that helper: move the
configure_rhocp_repo implementation (including use of run_command_on_vm,
copy_file_to_vm, mktemp/tmp_file handling, ocp_repo_name logic and the two
branches for numeric vs http rhocp values) into a common sourced file (e.g., a
shared test helper) and update each caller script to source that helper and
invoke configure_rhocp_repo with the same arguments; ensure the tmp file
creation and removal, quoting, and error behavior are preserved when refactoring
so existing behavior remains unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@test/bin/pyutils/generate_common_versions.py`:
- Around line 275-285: The loop in the version-selection logic can crash because
get_previous_version(current_major, current_minor) may raise KeyError when
versions are exhausted; wrap that call in a try/except KeyError inside the
for-loop (the block using current_major/current_minor and
gitops_version_from_api_docs) and on KeyError break out (or return an empty
string) so the function safely falls through to the final return ""; ensure you
update references to current_major/current_minor only when the call succeeds and
preserve existing logging/return behavior for gitops_version_number.

---

Nitpick comments:
In `@test/scenarios/presubmits/el98-src`@rpm-install.sh.disabled:
- Around line 44-72: Extract the configure_rhocp_repo function into a shared
helper script and replace the duplicated copies with calls to that helper: move
the configure_rhocp_repo implementation (including use of run_command_on_vm,
copy_file_to_vm, mktemp/tmp_file handling, ocp_repo_name logic and the two
branches for numeric vs http rhocp values) into a common sourced file (e.g., a
shared test helper) and update each caller script to source that helper and
invoke configure_rhocp_repo with the same arguments; ensure the tmp file
creation and removal, quoting, and error behavior are preserved when refactoring
so existing behavior remains unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: cfebe57e-2add-42e0-9763-426048363e77

📥 Commits

Reviewing files that changed from the base of the PR and between c6a53ad and 2db639e.

📒 Files selected for processing (19)
  • scripts/devenv-builder/configure-vm.sh
  • scripts/get-latest-rhocp-repo.sh
  • scripts/release-notes/gen_gh_releases_from_mirror.py
  • scripts/release-notes/gen_gh_releases_from_rhocp.py
  • test/assets/common_versions.sh.template
  • test/bin/build_rpms.sh
  • test/bin/common.sh
  • test/bin/common_versions.sh
  • test/bin/pyutils/build_bootc_images.py
  • test/bin/pyutils/generate_common_versions.py
  • test/bin/scenario.sh
  • test/kickstart-templates/includes/post-cos9rpm.cfg
  • test/package-sources/rhocp-y.toml
  • test/package-sources/rhocp-y1.toml
  • test/package-sources/rhocp-y2.toml
  • test/scenarios/presubmits/el98-src@rpm-install.sh.disabled
  • test/scenarios/releases/el98@rpm-standard1.sh.disabled
  • test/scenarios/releases/el98@rpm-standard2.sh.disabled
  • test/scenarios/releases/el98@rpm-upgrade.sh.disabled
✅ Files skipped from review due to trivial changes (5)
  • test/bin/scenario.sh
  • test/bin/common.sh
  • scripts/release-notes/gen_gh_releases_from_rhocp.py
  • test/package-sources/rhocp-y2.toml
  • test/package-sources/rhocp-y1.toml
🚧 Files skipped from review as they are similar to previous changes (4)
  • scripts/get-latest-rhocp-repo.sh
  • test/scenarios/releases/el98@rpm-upgrade.sh.disabled
  • test/package-sources/rhocp-y.toml
  • scripts/devenv-builder/configure-vm.sh

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 23, 2026

@pacevedom: 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/e2e-aws-tests-periodic 2db639e link true /test e2e-aws-tests-periodic
ci/prow/e2e-aws-tests-bootc-release-el9 2db639e link true /test e2e-aws-tests-bootc-release-el9
ci/prow/e2e-aws-tests-release-arm 2db639e link true /test e2e-aws-tests-release-arm
ci/prow/e2e-aws-tests-release 2db639e link true /test e2e-aws-tests-release
ci/prow/e2e-aws-tests-bootc-release-arm-el10 2db639e link true /test e2e-aws-tests-bootc-release-arm-el10
ci/prow/e2e-aws-tests-bootc-release-arm-el9 2db639e link true /test e2e-aws-tests-bootc-release-arm-el9
ci/prow/e2e-aws-tests-bootc-arm-el10 2db639e link true /test e2e-aws-tests-bootc-arm-el10
ci/prow/e2e-aws-tests-bootc-release-el10 2db639e link true /test e2e-aws-tests-bootc-release-el10

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants