Add script to update ReleasePlan Jira fixVersion query#449
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: openshift/coderabbit/.coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughAdds a new bash script that accepts a fix-version argument, builds a Jira JQL query, patches a ReleasePlan collector query with ChangesRelease Plan Jira Query Script
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 15✅ Passed checks (15 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
hack/update-releaseplan-jira-query.sh (2)
23-25: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick winVerification step doesn't assert success.
The script prints the post-patch value but never compares it to the expected
${QUERY}, so a failed/partial patch (e.g. wrong index silently updating an unrelated field) wouldn't be caught automatically.✅ Proposed assertion
echo "Done. Verifying:" -oc get releaseplan "${RELEASEPLAN}" -n "${NAMESPACE}" -o jsonpath='{.spec.collectors.items[0].params[1].value}' -echo +ACTUAL=$(oc get releaseplan "${RELEASEPLAN}" -n "${NAMESPACE}" -o jsonpath='{.spec.collectors.items[0].params[1].value}') +echo "${ACTUAL}" +if [[ "${ACTUAL}" != "${QUERY}" ]]; then + echo "Error: patched value does not match expected query" >&2 + exit 1 +fi🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@hack/update-releaseplan-jira-query.sh` around lines 23 - 25, The verification in update-releaseplan-jira-query.sh only prints the current value from oc get releaseplan and does not assert that the patched query matches the expected ${QUERY}. Update the post-patch check near the final oc get releaseplan command to compare the returned value against ${QUERY} and fail the script if they differ, so the verification step in the release plan update flow actually validates the intended field was changed.
18-21: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick winHardcoded JSON-patch array indices are fragile.
/spec/collectors/items/0/params/1/value(line 21) assumes a fixed position for the fixVersion param. If the collectors/params ordering ever changes (e.g. a new param inserted before the query, or another collector added), this patch will silently target the wrong field instead of failing loudly, sinceoc patch --type=json replaceonly errors when the index is entirely out of bounds, not when it points at an unrelated field.Consider resolving the target index dynamically (e.g. via
oc get -o json | jqto find the param whose key/name matches the query field) or, at minimum, fetching and printing the pre-patch value at that path so drift is caught before applying.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@hack/update-releaseplan-jira-query.sh` around lines 18 - 21, The JSON patch in update-releaseplan-jira-query.sh is relying on hardcoded array positions for the query field, which can silently hit the wrong collector/param when ordering changes. Update the script to locate the target parameter dynamically in the releaseplan JSON before calling oc patch, using the existing RELEASEPLAN, NAMESPACE, and QUERY flow. If you keep positional patching, at least read and print the current value at the resolved path first so drift is detected before applying the replacement.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@hack/update-releaseplan-jira-query.sh`:
- Line 6: Validate the user-supplied FIX_VERSION before it is used to build
QUERY or passed to oc patch, since the current shell variable is interpolated
into both JQL and the JSON patch payload. Add a strict format check immediately
after FIX_VERSION is assigned in update-releaseplan-jira-query.sh, rejecting
values that contain quotes or other unsafe characters and exiting with a clear
usage/error message. Keep the existing QUERY construction and oc patch
invocation unchanged except for using the validated FIX_VERSION value.
---
Nitpick comments:
In `@hack/update-releaseplan-jira-query.sh`:
- Around line 23-25: The verification in update-releaseplan-jira-query.sh only
prints the current value from oc get releaseplan and does not assert that the
patched query matches the expected ${QUERY}. Update the post-patch check near
the final oc get releaseplan command to compare the returned value against
${QUERY} and fail the script if they differ, so the verification step in the
release plan update flow actually validates the intended field was changed.
- Around line 18-21: The JSON patch in update-releaseplan-jira-query.sh is
relying on hardcoded array positions for the query field, which can silently hit
the wrong collector/param when ordering changes. Update the script to locate the
target parameter dynamically in the releaseplan JSON before calling oc patch,
using the existing RELEASEPLAN, NAMESPACE, and QUERY flow. If you keep
positional patching, at least read and print the current value at the resolved
path first so drift is detected before applying the replacement.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: e2147f59-8155-4872-9cba-a140aebeaf70
📒 Files selected for processing (1)
hack/update-releaseplan-jira-query.sh
Adds hack/update-releaseplan-jira-query.sh to patch the Jira collector fixVersion on the ReleasePlan CR each release cycle. Usage: hack/update-releaseplan-jira-query.sh <fix-version>
|
@AnnaZivkovic: The following tests failed, say
Full PR test history. Your PR dashboard. DetailsInstructions 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. |
Adds hack/update-releaseplan-jira-query.sh to patch the Jira collector fixVersion on the ReleasePlan CR each release cycle.
Usage: hack/update-releaseplan-jira-query.sh
Summary by CodeRabbit