-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
chore: Check github releases for upgrades #6162
Conversation
WalkthroughThe changes in this pull request involve updates to the Changes
Possibly related PRs
Suggested reviewers
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 4
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (2)
deploy/selfhost/README.md
(1 hunks)deploy/selfhost/install.sh
(7 hunks)
🧰 Additional context used
🪛 Shellcheck (0.10.0)
deploy/selfhost/install.sh
[warning] 60-60: Declare and assign separately to avoid masking return values.
(SC2155)
[warning] 219-219: Declare and assign separately to avoid masking return values.
(SC2155)
[warning] 250-250: Quote this to prevent word splitting.
(SC2046)
[warning] 258-258: Quote this to prevent word splitting.
(SC2046)
[warning] 272-272: Quote this to prevent word splitting.
(SC2046)
[warning] 280-280: Quote this to prevent word splitting.
(SC2046)
[warning] 394-394: Declare and assign separately to avoid masking return values.
(SC2155)
🔇 Additional comments (2)
deploy/selfhost/install.sh (1)
7-7
: Introduction of dynamic repository and release variables
The addition of GH_REPO
, RELEASE_DOWNLOAD_URL
, and FALLBACK_DOWNLOAD_URL
variables enhances the script's flexibility by allowing dynamic management of repositories and release versions.
Also applies to: 10-12
deploy/selfhost/README.md (1)
65-65
: Update download URL to fetch the latest stable setup.sh
Changing the download URL to https://github.com/makeplane/plane/releases/latest/download/setup.sh
ensures users always obtain the most recent stable version of the setup script.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (1)
deploy/selfhost/install.sh (1)
250-292
: Enhance error handling in download operationsThe error handling for downloads is good, but could be improved with more specific error messages and retry logic.
Consider adding:
- Retry logic for transient network issues
- More specific error messages based on HTTP status codes
- Timeout handling
Example implementation:
function download() { + local MAX_RETRIES=3 + local RETRY_DELAY=5 + local attempt=1 + + download_with_retry() { + local url=$1 + local output_file=$2 + + while [ $attempt -le $MAX_RETRIES ]; do + RESPONSE=$(curl -H 'Cache-Control: no-cache, no-store' -m 30 -s -w "HTTPSTATUS:%{http_code}" "$url?$(date +%s)") + STATUS=$(echo "$RESPONSE" | tr -d '\n' | sed -e 's/.*HTTPSTATUS://') + + case $STATUS in + 200) + echo "$BODY" > "$output_file" + return 0 + ;; + 404) + echo "Resource not found at $url" + return 1 + ;; + *) + if [ $attempt -lt $MAX_RETRIES ]; then + echo "Attempt $attempt failed with status $STATUS. Retrying in $RETRY_DELAY seconds..." + sleep $RETRY_DELAY + fi + ;; + esac + attempt=$((attempt + 1)) + done + return 1 + }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
deploy/selfhost/install.sh
(7 hunks)
🧰 Additional context used
🪛 Shellcheck (0.10.0)
deploy/selfhost/install.sh
[warning] 60-60: Declare and assign separately to avoid masking return values.
(SC2155)
[warning] 219-219: Declare and assign separately to avoid masking return values.
(SC2155)
[warning] 394-394: Declare and assign separately to avoid masking return values.
(SC2155)
🔇 Additional comments (5)
deploy/selfhost/install.sh (5)
10-12
: LGTM: Environment variables for release management
The addition of GH_REPO
, RELEASE_DOWNLOAD_URL
, and FALLBACK_DOWNLOAD_URL
variables improves maintainability by centralizing repository configuration.
140-145
: LGTM: OS-specific sed handling
Good addition of OS-specific sed syntax handling for macOS compatibility.
58-67
:
Fix potential return value masking in checkLatestRelease
The current implementation may mask curl command failures.
Apply this diff to fix the issue:
function checkLatestRelease(){
echo "Checking for the latest release..." >&2
- local latest_release=$(curl -s https://api.github.com/repos/$GH_REPO/releases/latest | grep -o '"tag_name": "[^"]*"' | sed 's/"tag_name": "//;s/"//g')
+ local latest_release
+ latest_release=$(curl -s https://api.github.com/repos/$GH_REPO/releases/latest | grep -o '"tag_name": "[^"]*"' | sed 's/"tag_name": "//;s/"//g')
if [ -z "$latest_release" ]; then
echo "Failed to check for the latest release. Exiting..." >&2
exit 1
fi
echo $latest_release
}
🧰 Tools
🪛 Shellcheck (0.10.0)
[warning] 60-60: Declare and assign separately to avoid masking return values.
(SC2155)
394-421
:
Fix return value masking in upgrade function
Similar to the checkLatestRelease
function, the upgrade function has potential return value masking.
Apply this diff to fix the issue:
function upgrade() {
- local latest_release=$(checkLatestRelease)
+ local latest_release
+ latest_release=$(checkLatestRelease)
🧰 Tools
🪛 Shellcheck (0.10.0)
[warning] 394-394: Declare and assign separately to avoid masking return values.
(SC2155)
218-220
:
Fix return value masking in APP_RELEASE assignment
The export with command substitution may mask errors.
Apply this diff to fix the issue:
if [ "$APP_RELEASE" == "stable" ]; then
- export APP_RELEASE=$(checkLatestRelease)
+ APP_RELEASE=$(checkLatestRelease)
+ export APP_RELEASE
fi
🧰 Tools
🪛 Shellcheck (0.10.0)
[warning] 219-219: Declare and assign separately to avoid masking return values.
(SC2155)
…reduce redundant API calls (#6159)
Summary by CodeRabbit
New Features
Documentation
These updates enhance the overall user experience and reliability of the setup process for the Plane application.