Skip to content

chore: add helper workflow for operator upgrade tests#19415

Open
Molter73 wants to merge 1 commit intomasterfrom
mauro/release/add-operator-upgrade-test-helper
Open

chore: add helper workflow for operator upgrade tests#19415
Molter73 wants to merge 1 commit intomasterfrom
mauro/release/add-operator-upgrade-test-helper

Conversation

@Molter73
Copy link
Contributor

@Molter73 Molter73 commented Mar 13, 2026

Description

The operator upgrade tests require two separate OCP clusters that need to be compatible with the version of StackRox being tested and either the oldest version supported or two minor versions prior. Two separate pages need to be checked in order to fully get the information on what the start version should be and what OCP version to use.

Instead of doing this by hand, this patch adds a python script and a GH workflow to simplify the process. The script will use Selenium to retrieve each page, find the relevant information from each with a combination of BeautifulSoup and regex, finally calculate the needed versions and output them to stdout.

Assisted-by: Claude Sonnet 4.5 noreply@anthropic.com

User-facing documentation

Testing and quality

  • the change is production ready: the change is GA, or otherwise the functionality is gated by a feature flag
  • CI results are inspected

Automated testing

  • added unit tests
  • added e2e tests
  • added regression tests
  • added compatibility tests
  • modified existing tests

How I validated my change

Manually tried different versions of ACS and checked the result was correct.
Ran the GH workflow with a testing matrix and validated the versions returned: https://github.com/stackrox/stackrox/actions/runs/23054970395

@openshift-ci
Copy link

openshift-ci bot commented Mar 13, 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

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • There is a leftover import pdb and pdb.set_trace() in start_version() which will pause execution and break the GitHub workflow run; this should be removed before merge.
  • The usage/help text in main() still refers to rhacs_versions.py, which does not match the actual script filename (operator-upgrade-test-helper.py); update the message so users see the correct command.
  • In the workflow, the workflow_dispatch input version is never used and the job always runs over a hard-coded matrix of versions; consider either wiring the input into the run or separating the fixed-matrix validation from the manual helper workflow so the behavior is clearer.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- There is a leftover `import pdb` and `pdb.set_trace()` in `start_version()` which will pause execution and break the GitHub workflow run; this should be removed before merge.
- The usage/help text in `main()` still refers to `rhacs_versions.py`, which does not match the actual script filename (`operator-upgrade-test-helper.py`); update the message so users see the correct command.
- In the workflow, the `workflow_dispatch` input `version` is never used and the job always runs over a hard-coded matrix of versions; consider either wiring the input into the run or separating the fixed-matrix validation from the manual helper workflow so the behavior is clearer.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@Molter73 Molter73 force-pushed the mauro/release/add-operator-upgrade-test-helper branch 3 times, most recently from 6b6e89a to 6d74b2f Compare March 13, 2026 14:26
@rhacs-bot
Copy link
Contributor

rhacs-bot commented Mar 13, 2026

Images are ready for the commit at 4d878c4.

To use with deploy scripts, first export MAIN_IMAGE_TAG=4.11.x-319-g4d878c4cd8.

The operator upgrade tests require two separate OCP clusters that need
to be compatible with the version of StackRox being tested and either
the oldest version supported or two minor versions prior. Two separate
pages need to be checked in order to fully get the information on what
the start version should be and what OCP version to use.

Instead of doing this by hand, this patch adds a python script and a GH
workflow to simplify the process. The script will use Selenium to
retrieve each page, find the relevant information from each with a
combination of BeautifulSoup and regex, finally calculate the needed
versions and output them to stdout.

Assisted-by: Claude Sonnet 4.5 <noreply@anthropic.com>
@Molter73 Molter73 force-pushed the mauro/release/add-operator-upgrade-test-helper branch from 6d74b2f to 4d878c4 Compare March 13, 2026 14:29
@Molter73 Molter73 marked this pull request as ready for review March 13, 2026 14:33
@Molter73 Molter73 requested a review from a team as a code owner March 13, 2026 14:33
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • In find_compatible_openshift, the branch where target_ocp_version is empty assumes start_ocp_version is non-empty (max(start_ocp_version)), which will raise if the matrix lacks entries for the start version; consider short-circuiting with a clearer error or fallback when either side has no compatibility data.
  • In start_version, max([v for v in all_versions if v.major == version.major - 1]) will fail if there are no entries for the previous major (e.g., early in a new major); you may want to explicitly detect this case and either fallback to the oldest supported version or emit a clear error instead of relying on ValueError from max().
  • The HTML/shadow-DOM parsing in parse_supported_versions and parse_all_versions depends on brittle regexes and specific strings like product-lifecycle-Full Support; adding basic validation (e.g., ensuring expected tables/sections are present and failing with a clear message if not) will make the script more robust to minor page layout/content changes.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `find_compatible_openshift`, the branch where `target_ocp_version` is empty assumes `start_ocp_version` is non-empty (`max(start_ocp_version)`), which will raise if the matrix lacks entries for the start version; consider short-circuiting with a clearer error or fallback when either side has no compatibility data.
- In `start_version`, `max([v for v in all_versions if v.major == version.major - 1])` will fail if there are no entries for the previous major (e.g., early in a new major); you may want to explicitly detect this case and either fallback to the oldest supported version or emit a clear error instead of relying on `ValueError` from `max()`.
- The HTML/shadow-DOM parsing in `parse_supported_versions` and `parse_all_versions` depends on brittle regexes and specific strings like `product-lifecycle-Full Support`; adding basic validation (e.g., ensuring expected tables/sections are present and failing with a clear message if not) will make the script more robust to minor page layout/content changes.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@codecov
Copy link

codecov bot commented Mar 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 49.71%. Comparing base (66a258b) to head (4d878c4).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #19415   +/-   ##
=======================================
  Coverage   49.70%   49.71%           
=======================================
  Files        2701     2701           
  Lines      203453   203453           
=======================================
+ Hits       101134   101147   +13     
+ Misses      94790    94781    -9     
+ Partials     7529     7525    -4     
Flag Coverage Δ
go-unit-tests 49.71% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants