Skip to content
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

Merged
merged 19 commits into from
Dec 16, 2024
Merged

Conversation

mguptahub
Copy link
Collaborator

@mguptahub mguptahub commented Dec 5, 2024

Summary by CodeRabbit

  • New Features

    • Updated installation instructions for a self-hosted environment, ensuring users download the latest stable setup script.
    • Enhanced error handling in the installation script with fallback download options and improved compatibility across operating systems.
  • Documentation

    • Refined README for clarity, including rephrased installation and upgrade instructions.

These updates enhance the overall user experience and reliability of the setup process for the Plane application.

Copy link
Contributor

coderabbitai bot commented Dec 5, 2024

Walkthrough

The changes in this pull request involve updates to the README.md and install.sh files for the Plane application. The README.md now includes a more reliable download URL for the setup script, enhancing clarity and organization of the installation instructions. The install.sh script has been modified to improve error handling, introduce new environment variables for dynamic management, and ensure compatibility across different operating systems. These updates collectively enhance the usability and reliability of setting up a self-hosted environment.

Changes

File Change Summary
deploy/selfhost/README.md Updated download URL for setup script; refined instructions for clarity; minor grammatical fixes.
deploy/selfhost/install.sh Added new environment variables; improved error handling for downloads; ensured macOS compatibility; refactored download process.

Possibly related PRs

Suggested reviewers

  • sriramveeraghanta

Poem

In the burrow where we play,
A new script leads the way.
With clearer paths and links so bright,
Setting up is now a delight!
Hop along, let’s install with glee,
A self-hosted home for you and me! 🐇✨


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?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

📥 Commits

Reviewing files that changed from the base of the PR and between b1c340b and 9b0a721.

📒 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.

deploy/selfhost/install.sh Outdated Show resolved Hide resolved
@makeplane makeplane deleted a comment from coderabbitai bot Dec 5, 2024
@makeplane makeplane deleted a comment from coderabbitai bot Dec 5, 2024
@makeplane makeplane deleted a comment from coderabbitai bot Dec 5, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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 operations

The error handling for downloads is good, but could be improved with more specific error messages and retry logic.

Consider adding:

  1. Retry logic for transient network issues
  2. More specific error messages based on HTTP status codes
  3. 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

📥 Commits

Reviewing files that changed from the base of the PR and between 9b0a721 and c416780.

📒 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: ⚠️ Potential issue

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: ⚠️ Potential issue

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: ⚠️ Potential issue

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)

@sriramveeraghanta sriramveeraghanta merged commit a0f03d0 into preview Dec 16, 2024
13 of 14 checks passed
@sriramveeraghanta sriramveeraghanta deleted the fix/build-release branch December 16, 2024 07:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants