Fix regex check for tag_name to get latest release - #9548
Conversation
📝 WalkthroughWalkthroughBoth deployment scripts update their release tag parsing logic. The regex used to extract the ChangesRelease tag parsing fix
Estimated code review effort: 1 (Trivial) | ~2 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR aims to make the “latest GitHub release” detection in the community install scripts resilient to GitHub API responses that omit spaces in JSON ("tag_name":"vX.Y.Z" vs "tag_name": "vX.Y.Z"), preventing installs/upgrades from failing.
Changes:
- Updates the
grep/sedparsing used to extracttag_namefrom the GitHub Releases API response in the Swarm installer script. - Updates the same parsing logic in the CLI community installer script.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| deployments/swarm/community/swarm.sh | Adjusts the tag_name extraction regex in checkLatestRelease() to handle compact JSON responses. |
| deployments/cli/community/install.sh | Adjusts the tag_name extraction regex in checkLatestRelease() to handle compact JSON responses. |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
deployments/cli/community/install.sh (1)
60-60: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick winPreserve command failure status in both release lookups.
local latest_release=$(...)can return success when the command substitution fails, so empty responses do not reliably stopset -escripts. This affects bothdeployments/cli/community/install.sh:60anddeployments/swarm/community/swarm.sh:41. Declarelatest_releaseseparately, assign the pipeline, check bothlocaland the assignment status, and addpipefailifcurl,grep, orsedfailures must propagate.🤖 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 `@deployments/cli/community/install.sh` at line 60, Preserve release lookup failures in both deployments/cli/community/install.sh:60 and deployments/swarm/community/swarm.sh:41. In each script, declare latest_release separately, assign the curl/grep/sed pipeline while explicitly checking both the local declaration and assignment status, and enable pipefail so failures from any pipeline command propagate under set -e.Source: Linters/SAST tools
🤖 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 `@deployments/cli/community/install.sh`:
- Line 60: Update the latest_release assignment’s sed cleanup in the
release-fetch command to remove the tag_name prefix followed by optional
whitespace, matching the preceding grep pattern, while preserving the existing
trailing-quote cleanup.
---
Nitpick comments:
In `@deployments/cli/community/install.sh`:
- Line 60: Preserve release lookup failures in both
deployments/cli/community/install.sh:60 and
deployments/swarm/community/swarm.sh:41. In each script, declare latest_release
separately, assign the curl/grep/sed pipeline while explicitly checking both the
local declaration and assignment status, and enable pipefail so failures from
any pipeline command propagate under set -e.
🪄 Autofix
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: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: db5c8ba1-4020-4d1a-a641-5163c08a87a3
📒 Files selected for processing (2)
deployments/cli/community/install.shdeployments/swarm/community/swarm.sh
Description
When attempting to install the community edition, a check is performed to get the latest release. Due to inconsistent responses from GitHub, the previous regex supplied might not match the return (it always expects a space, sometimes one is not supplied) and then the check fails.
Type of Change
Screenshots and Media (if applicable)
Test Scenarios
References
#8911
Summary by CodeRabbit