Skip to content

fix the download url in install script #1397

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

Merged
merged 3 commits into from
Aug 1, 2025

Conversation

nitisht
Copy link
Member

@nitisht nitisht commented Aug 1, 2025

Summary by CodeRabbit

  • New Features

    • Added support for downloading platform-specific binaries for macOS (Intel and ARM), Linux, and Windows.
    • The script now prints the exact download URL before starting the download.
  • Bug Fixes

    • Improved error handling for unsupported operating systems and CPU architectures.
    • The script now checks for the presence of a release tag and exits if missing.
  • Chores

    • Enhanced script logic for more reliable platform detection and download process.
    • The shell RC file is now sourced automatically after updating the PATH.

Copy link
Contributor

coderabbitai bot commented Aug 1, 2025

Walkthrough

The scripts/download.sh script was updated to construct download URLs using detailed GitHub release paths based on OS and CPU architecture, with explicit handling for ARM and Intel variants across macOS and Linux. The script now checks for supported platforms, verifies release tags, includes robust error handling, prints the download URL before fetching, and refreshes the environment by sourcing the shell RC file after updating PATH.

Changes

Cohort / File(s) Change Summary
Download Script Platform & URL Logic
scripts/download.sh
Refined download URL construction using GitHub releases with OS and CPU-specific binary prefixes, added platform and architecture validation, enhanced error handling for missing tools and release tags, informative output of URLs, and automatic environment refresh by sourcing shell RC file after PATH update.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Script
    participant GitHub API

    User->>Script: Run download.sh
    Script->>Script: Detect OS and CPU architecture
    Script->>Script: Validate supported platform and architecture
    Script->>GitHub API: Fetch latest release tag
    GitHub API-->>Script: Return release tag
    Script->>Script: Construct download URL with binary prefix
    Script->>User: Print download URL
    Script->>Script: Download binary (curl or wget) with error checks
    Script->>Script: Append binary path to PATH in shell RC file
    Script->>Script: Source shell RC file to refresh environment
    Script->>User: Output success or error message
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐇
A script now hops with careful feet,
Checks OS, arch, and tag so neat.
URLs built with extra care,
For every platform, everywhere!
With smarter flow and clearer cheer,
Downloading binaries—no more fear!

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1d6c278 and e9c476b.

📒 Files selected for processing (1)
  • scripts/download.sh (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • scripts/download.sh
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
  • GitHub Check: Build Default aarch64-unknown-linux-gnu
  • GitHub Check: Build Default x86_64-apple-darwin
  • GitHub Check: Build Default x86_64-pc-windows-msvc
  • GitHub Check: Build Default x86_64-unknown-linux-gnu
  • GitHub Check: Build Kafka x86_64-unknown-linux-gnu
  • GitHub Check: Build Kafka aarch64-apple-darwin
  • GitHub Check: Quest Smoke and Load Tests for Distributed deployments
  • GitHub Check: coverage
  • GitHub Check: Quest Smoke and Load Tests for Standalone deployments
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this 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

🔭 Outside diff range comments (1)
scripts/download.sh (1)

15-17: uname -swindows mapping is unreliable on Git Bash / MSYS

uname -s on Windows commonly returns strings like MINGW64_NT-10.0-19045, not “windows”.
A simple lowercase transform therefore fails the supported-OS check.

-OS=$(uname -s | tr '[:upper:]' '[:lower:]')
+raw_os=$(uname -s)
+case "${raw_os}" in
+  Linux*)   OS=linux ;;
+  Darwin*)  OS=darwin ;;
+  MINGW*|MSYS*|CYGWIN*) OS=windows ;;
+  *)        OS=$(echo "${raw_os}" | tr '[:upper:]' '[:lower:]') ;;
+esac

This normalises the typical Windows variants and preserves existing behaviour for Linux/macOS.

🧹 Nitpick comments (1)
scripts/download.sh (1)

108-110: PATH export may be duplicated on re-runs

Each execution blindly appends export PATH=… to the RC file, producing multiple identical lines.
Before appending, grep the file for the string or wrap the stanza with a marker comment to avoid clutter.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ecdb27f and 578784e.

📒 Files selected for processing (1)
  • scripts/download.sh (3 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: in the parseable project, the linux-specific environment variables (pkg_config_path, sasl2_dir, open...
Learnt from: nikhilsinhaparseable
PR: parseablehq/parseable#1302
File: .github/workflows/build.yaml:170-175
Timestamp: 2025-04-26T03:58:02.341Z
Learning: In the parseable project, the Linux-specific environment variables (PKG_CONFIG_PATH, SASL2_DIR, OPENSSL_DIR, OPENSSL_ROOT_DIR, SASL2_STATIC) in the Kafka build step of GitHub Actions workflows don't cause issues for macOS builds and can safely be applied to both platforms.

Applied to files:

  • scripts/download.sh
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
  • GitHub Check: Build Default x86_64-pc-windows-msvc
  • GitHub Check: Build Default x86_64-unknown-linux-gnu
  • GitHub Check: coverage
  • GitHub Check: Build Default aarch64-unknown-linux-gnu
  • GitHub Check: Build Default aarch64-apple-darwin
  • GitHub Check: Build Default x86_64-apple-darwin
  • GitHub Check: Build Kafka x86_64-unknown-linux-gnu
  • GitHub Check: Build Kafka aarch64-apple-darwin
  • GitHub Check: Quest Smoke and Load Tests for Standalone deployments
  • GitHub Check: Quest Smoke and Load Tests for Distributed deployments

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: 2

🧹 Nitpick comments (2)
scripts/download.sh (2)

43-46: Use jq to extract the tag name, fail fast on network errors

grep | cut is brittle if GitHub changes its JSON formatting.
curl -f already aborts on HTTP errors; pipe directly to jq for robustness:

release_tag=$(curl -fsSL \
  https://api.github.com/repos/parseablehq/parseable/releases/latest |
  jq -r '.tag_name')

if [[ -z "$release_tag" || "$release_tag" == "null" ]]; then
  echo "Error: could not determine the latest release"; exit 1
fi

Requires adding jq to prerequisites (most macOS/Linux users already have it via package managers).


101-103: Avoid sourcing a potentially enormous rc file inside the installer

source ${RC_FILE_PATH} executes arbitrary user configuration and may produce side-effects or prompt for input in non-interactive installs.

Prefer instructing the user to exec $SHELL or reopen their terminal instead of auto-sourcing:

echo "Add '${BIN_DIR}' to PATH by running: source ${RC_FILE_PATH} or start a new shell session."
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 578784e and 1d6c278.

📒 Files selected for processing (1)
  • scripts/download.sh (4 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: in the parseable project, the linux-specific environment variables (pkg_config_path, sasl2_dir, open...
Learnt from: nikhilsinhaparseable
PR: parseablehq/parseable#1302
File: .github/workflows/build.yaml:170-175
Timestamp: 2025-04-26T03:58:02.341Z
Learning: In the parseable project, the Linux-specific environment variables (PKG_CONFIG_PATH, SASL2_DIR, OPENSSL_DIR, OPENSSL_ROOT_DIR, SASL2_STATIC) in the Kafka build step of GitHub Actions workflows don't cause issues for macOS builds and can safely be applied to both platforms.

Applied to files:

  • scripts/download.sh
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
  • GitHub Check: Build Default aarch64-unknown-linux-gnu
  • GitHub Check: Build Default x86_64-pc-windows-msvc
  • GitHub Check: Build Default x86_64-apple-darwin
  • GitHub Check: Build Default x86_64-unknown-linux-gnu
  • GitHub Check: Build Kafka aarch64-apple-darwin
  • GitHub Check: Build Kafka x86_64-unknown-linux-gnu
  • GitHub Check: coverage
  • GitHub Check: Quest Smoke and Load Tests for Standalone deployments
  • GitHub Check: Quest Smoke and Load Tests for Distributed deployments
🔇 Additional comments (1)
scripts/download.sh (1)

85-92: Extract the tarball and verify the binary before advertising success

After the previous fix, you will have a *.tar.gz.
Before printing “successfully installed”, add:

tar -xf "${BIN_NAME}${ASSET_EXT}" -C "${BIN_DIR}" parseable || {
  echo "Error: failed to extract binary"; exit 1;
}
rm "${BIN_NAME}${ASSET_EXT}"

Also run a trivial smoke test ("${BIN_DIR}/parseable" --version) and abort if it fails.

@nitisht nitisht merged commit 17ef955 into parseablehq:main Aug 1, 2025
13 checks passed
@nitisht nitisht deleted the fix-download-script branch August 1, 2025 13:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant