Skip to content

ROX-28901: Derive EARLIER_CHART_VERSION in scanner-v4-install tests #15594

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 12, 2025

Conversation

mclasmeier
Copy link
Contributor

@mclasmeier mclasmeier commented Jun 5, 2025

Description

Don't hard-code an older version, instead derive a previous version from the existing git tags.

User-facing documentation

Just a change in tests, nothing user-facing.

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

  • modified existing tests

How I validated my change

  • Tested the function locally.
  • CI results.

From the CI log:

INFO: Thu Jun 12 11:05:52 UTC 2025: [setup-file] Using MAIN_IMAGE_TAG=4.9.x-47-gf4e58726af
INFO: Thu Jun 12 11:05:52 UTC 2025: [setup-file] Cloning released Helm charts into /tmp/helm-charts.hEJf2a...
INFO: Thu Jun 12 11:05:56 UTC 2025: [setup-file] Using EARLIER_CHART_VERSION=4.7.0

which is correct (given that Helm charts fro 4.8.x have not yet been released).

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 @mclasmeier - I've reviewed your changes - here's some feedback:

  • Adjust the grep and sed regex to support multi-digit patch versions (e.g. use '[0-9]+' for the z component) so tags like '1.10.12' aren’t dropped.
  • Use a version-aware sort (e.g. sort -V) instead of numeric sort on the x.y string to correctly order multi-digit versions.
  • Add explicit error handling or a clear fallback when no previous x.y.0 tag exists to avoid silent failures in the test.
Here's what I looked at during the review
  • 🟡 General issues: 3 issues found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

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.

@mclasmeier mclasmeier changed the title Don't hard-code EARLIER_CHART_VERSION in scanner-v4-install tests fix: Don't hard-code EARLIER_CHART_VERSION in scanner-v4-install tests Jun 5, 2025
@rhacs-bot
Copy link
Contributor

rhacs-bot commented Jun 5, 2025

Images are ready for the commit at f4e5872.

To use with deploy scripts, first export MAIN_IMAGE_TAG=4.9.x-47-gf4e58726af.

Copy link

codecov bot commented Jun 5, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 48.79%. Comparing base (3864927) to head (f4e5872).
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #15594      +/-   ##
==========================================
- Coverage   48.80%   48.79%   -0.01%     
==========================================
  Files        2590     2590              
  Lines      190492   190492              
==========================================
- Hits        92963    92960       -3     
- Misses      90231    90233       +2     
- Partials     7298     7299       +1     
Flag Coverage Δ
go-unit-tests 48.79% <ø> (-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.

@mclasmeier mclasmeier changed the title fix: Don't hard-code EARLIER_CHART_VERSION in scanner-v4-install tests ROX-28901: Don't hard-code EARLIER_CHART_VERSION in scanner-v4-install tests Jun 5, 2025
@mclasmeier mclasmeier requested review from porridge and vladbologa June 5, 2025 21:56
@mclasmeier mclasmeier force-pushed the mc/automatic-earlier-helm-version branch from 50def51 to 9ace8d9 Compare June 5, 2025 22:26
@mclasmeier mclasmeier changed the title ROX-28901: Don't hard-code EARLIER_CHART_VERSION in scanner-v4-install tests ROX-28901: Derive EARLIER_CHART_VERSION in scanner-v4-install tests Jun 5, 2025
@mclasmeier mclasmeier force-pushed the mc/automatic-earlier-helm-version branch 3 times, most recently from f8d517e to 74bb9bf Compare June 6, 2025 12:38
Copy link
Contributor

@porridge porridge left a comment

Choose a reason for hiding this comment

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

Compared to the way we figure out the previous version in the operator Makefile, this purely git-based method has the advantage that it's mostly offline, but it also has the disadvantage that it will generate an unusable version in the time frame between the x.y.0 tag is pushed to the git repo, to the moment the installation artifacts (images and perhaps also helm charts) are built and pushed.

Given that we need network connectivity anyway for this test to work, I think it would be preferable to use the image registry to check for previous version existence, than have a way which is offline but fails every now and then...

@mclasmeier
Copy link
Contributor Author

@porridge, see my last commit, I think I was able to increase reliability while also retaining the general approach.

Instead of using git tags and then hoping that this will allow the test suite to resolve the computed tag to resolve to a Helm chart version, I figured it would make much more sense to begin with Helm chart versions, because that is what is needed here.

So, the code now inspects the helm-charts repo, looks for the versions in that repo and then figures out what the 'previous' (x.y.0) version should be -- similar to what I previously did with git tags.

@mclasmeier mclasmeier requested a review from porridge June 10, 2025 09:40
@mclasmeier
Copy link
Contributor Author

/retest

@vladbologa
Copy link
Contributor

@sourcery-ai review

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 @mclasmeier - I've reviewed your changes - here's some feedback:

  • Consider extracting the new version‐resolution helpers (resolve_previous_x_y_0_version, list_sub_directories, etc.) into a shared test‐utility file to keep the main .bats script concise.
  • To speed up CI and reduce overhead, consider caching the cloned helm‐charts repo between runs or using a more focused shallow clone (e.g. limit tags) instead of pulling the full repo each time.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

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.

Copy link
Contributor

@porridge porridge left a comment

Choose a reason for hiding this comment

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

The new functions are rather complicated, so it would be great if there were some unit tests covering corner cases like when there exist previous patch versions or no patch version for the given minor version.

Copy link
Contributor

@vladbologa vladbologa left a comment

Choose a reason for hiding this comment

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

Looks good!

@mclasmeier mclasmeier force-pushed the mc/automatic-earlier-helm-version branch from ebe6899 to df14df5 Compare June 12, 2025 08:25
Copy link

openshift-ci bot commented Jun 12, 2025

@mclasmeier: 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/gke-qa-e2e-tests f4e5872 link false /test gke-qa-e2e-tests

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.

@mclasmeier mclasmeier merged commit 5bde8a5 into master Jun 12, 2025
91 of 92 checks passed
@mclasmeier mclasmeier deleted the mc/automatic-earlier-helm-version branch June 12, 2025 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants