ROX-33413: Add check to verify release version exists in scannver version file#19260
ROX-33413: Add check to verify release version exists in scannver version file#19260ksurabhi91 wants to merge 2 commits intomasterfrom
Conversation
|
Skipping CI for Draft Pull Request. |
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- The new check-scanner-version.sh script assumes GITHUB_REPOSITORY is set, which will not be true for local runs as suggested in the usage comment; consider either documenting that requirement or allowing the repository to be passed in as an argument or defaulting to a sensible local value.
- The script hardcodes the master branch in the GitHub API ref parameter; if the default branch ever changes, this will break silently, so consider using a configurable branch (e.g., an env var) instead of a literal 'master'.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The new check-scanner-version.sh script assumes GITHUB_REPOSITORY is set, which will not be true for local runs as suggested in the usage comment; consider either documenting that requirement or allowing the repository to be passed in as an argument or defaulting to a sensible local value.
- The script hardcodes the master branch in the GitHub API ref parameter; if the default branch ever changes, this will break silently, so consider using a configurable branch (e.g., an env var) instead of a literal 'master'.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
13e8f0f to
b8303d1
Compare
|
Images are ready for the commit at ae0d19b. To use with deploy scripts, first |
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- The
grep -q "^${VERSION}$"check incheck-scanner-version.shtreatsVERSIONas a regex, so versions with dots or other special characters may match incorrectly; consider usinggrep -Fx(orgrep -Fwith manual line-boundary handling) to perform an exact string match instead.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The `grep -q "^${VERSION}$"` check in `check-scanner-version.sh` treats `VERSION` as a regex, so versions with dots or other special characters may match incorrectly; consider using `grep -Fx` (or `grep -F` with manual line-boundary handling) to perform an exact string match instead.
## Individual Comments
### Comment 1
<location path=".github/workflows/scripts/check-scanner-version.sh" line_range="18" />
<code_context>
+SCANNER_VERSION=$(gh api -H "Accept: application/vnd.github.v3.raw" \
+ "/repos/${GITHUB_REPOSITORY}/contents/scanner/updater/version/RELEASE_VERSION?ref=master")
+
+if ! grep -q "^${VERSION}$" <<<"$SCANNER_VERSION"; then
+ gh_log error "Release version $VERSION (inferred from the tag '$TAG') not added to scanner/updater/version/RELEASE_VERSION in master branch"
+ gh_summary "Release version not found in scanner/updater/version/RELEASE_VERSION in master branch"
</code_context>
<issue_to_address>
**issue (bug_risk):** Use fixed-string matching for version to avoid regex semantics in grep.
`${VERSION}` is used as a grep regex here, so characters like `.` or `+` will be interpreted as metacharacters rather than literals, which can cause false matches or misses if version formats change. Prefer fixed-string, whole-line matching, e.g. `grep -Fqx -- "$VERSION" <<<"$SCANNER_VERSION"`, to avoid regex interpretation.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| SCANNER_VERSION=$(gh api -H "Accept: application/vnd.github.v3.raw" \ | ||
| "/repos/${GITHUB_REPOSITORY}/contents/scanner/updater/version/RELEASE_VERSION?ref=master") | ||
|
|
||
| if ! grep -q "^${VERSION}$" <<<"$SCANNER_VERSION"; then |
There was a problem hiding this comment.
issue (bug_risk): Use fixed-string matching for version to avoid regex semantics in grep.
${VERSION} is used as a grep regex here, so characters like . or + will be interpreted as metacharacters rather than literals, which can cause false matches or misses if version formats change. Prefer fixed-string, whole-line matching, e.g. grep -Fqx -- "$VERSION" <<<"$SCANNER_VERSION", to avoid regex interpretation.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #19260 +/- ##
==========================================
- Coverage 49.63% 49.63% -0.01%
==========================================
Files 2679 2679
Lines 202130 202130
==========================================
- Hits 100328 100325 -3
- Misses 94325 94327 +2
- Partials 7477 7478 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This PR adds a script in finish release workflow that verifies that planned release version exists in scanner version file. This will ensure that the rhacs-bot PR that makes this change is merged otherwise this check fails.

Script was tested locally using different version as input
change me!
User-facing documentation
Testing and quality
Automated testing
How I validated my change
change me!