OCPBUGS-85775: validate skipRange with blang/semver ParseRange#1987
Conversation
|
Skipping CI for Draft Pull Request. |
|
@joelanford: This pull request references Jira Issue OCPBUGS-85775, which is valid. The bug has been moved to the POST state. 3 validation(s) were run on this bug
The bug has been updated to refer to the pull request using the external bug tracker. DetailsIn 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. |
There was a problem hiding this comment.
Pull request overview
This PR adds skipRange syntax validation to bundle model validation so invalid semver ranges are caught by opm validate before publication/runtime graph use.
Changes:
- Validates non-empty
Bundle.SkipRangeusingblang/semver’sParseRange. - Adds unit tests covering a valid range and invalid ranges with a leading
vand leading zeroes.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
alpha/model/model.go |
Adds skipRange parse validation to Bundle.Validate(). |
alpha/model/model_test.go |
Adds validator test cases for valid and invalid skipRange values. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
opm validate silently accepts invalid skipRange values, which can lead to broken upgrade graphs discovered only at runtime. Parse the skipRange field using semver.ParseRange() and surface any error in the validation error tree.
86c5bbb to
8ac96c2
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1987 +/- ##
==========================================
+ Coverage 57.71% 57.88% +0.17%
==========================================
Files 139 140 +1
Lines 13373 13451 +78
==========================================
+ Hits 7718 7786 +68
- Misses 4468 4474 +6
- Partials 1187 1191 +4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: perdasilva The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/lgtm |
1ead90f
into
operator-framework:master
|
@joelanford: Jira Issue OCPBUGS-85775: All pull requests linked via external trackers have merged: Jira Issue OCPBUGS-85775 has been moved to the MODIFIED state. DetailsIn 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. |
Description of the change:
opm validatedoes not validate theskipRangefield in operator bundle metadata. Invalid semver ranges (e.g.>v0.1.0,>1.00.1) are silently accepted, which can lead to broken upgrade graphs discovered only at runtime.This PR adds validation of the
skipRangefield inBundle.Validate()usingsemver.ParseRange()from theblang/semverlibrary (already a dependency). Any parse error is surfaced in the validation error tree.Motivation for the change:
Invalid
skipRangevalues should be caught at build/validation time rather than at install time. This makesopm validatemore reliable as a pre-publish check.Reviewer Checklist
/docsJira: https://redhat.atlassian.net/browse/OCPBUGS-85775
🤖 Generated with Claude Code via
/jira:solve OCPBUGS-85775