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

fix: kurtosis install script #2175

Closed
wants to merge 1 commit into from
Closed

fix: kurtosis install script #2175

wants to merge 1 commit into from

Conversation

fridrik01
Copy link
Contributor

@fridrik01 fridrik01 commented Nov 24, 2024

There are two problems here:

  1. On Ubuntu, the command -v kurtosis &> /dev/null fails to detect if kurtosis is installed resulting in it trying to install it again.

  2. When extracting the kurtosis.tar.gz artifact it generates a kurtosis binary in current folder. However we already have a kurtosis/ folder in our repo so the extraction fails.

This commit fixes 1) so it works on any platform and addresses 2) by removing the kurtosis automatic installation which should be fine since its already a prerequisite in our kurtosis/README.md.

Summary by CodeRabbit

  • New Features

    • Introduced a verification step to check if the Kurtosis command is installed, enhancing user guidance for setup.
  • Bug Fixes

    • Streamlined the control flow for starting the development network by ensuring proper installation verification.
  • Documentation

    • Updated prompts to direct users to the README for installation instructions.

Copy link
Contributor

coderabbitai bot commented Nov 24, 2024

Walkthrough

The changes in this pull request involve modifications to the Makefile for the Kurtosis project. The install-kurtosis target has been replaced by a new target called verify-kurtosis-installed, which checks for the availability of the kurtosis command. If not found, it prompts the user to install Kurtosis and refers to the README for instructions. The start-devnet target now relies on this new verification target, and the previous installation logic has been removed. Minor formatting adjustments were also made.

Changes

File Change Summary
kurtosis/Makefile Removed install-kurtosis target; added verify-kurtosis-installed target for command availability check; adjusted start-devnet target dependency; made minor formatting changes.

Possibly related PRs

Suggested reviewers

  • nidhi-singh02
  • itsdevbear
  • ocnc

Poem

🐇 In the land of code where rabbits play,
A new target hops in to save the day!
"Verify-kurtosis," it cheerfully sings,
Ensuring all devs have the right things.
With a wink and a nudge, the old ways are gone,
Now let’s code on, till the break of dawn! 🌼


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

codecov bot commented Nov 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 26.34%. Comparing base (86b41a4) to head (8bb57c2).
Report is 342 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #2175   +/-   ##
=======================================
  Coverage   26.34%   26.34%           
=======================================
  Files         361      361           
  Lines       16297    16297           
  Branches       12       12           
=======================================
  Hits         4294     4294           
  Misses      11732    11732           
  Partials      271      271           

@fridrik01 fridrik01 self-assigned this Nov 24, 2024
@fridrik01 fridrik01 marked this pull request as ready for review November 24, 2024 15:58
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 comments (1)
kurtosis/Makefile (1)

Line range hint 71-73: Remove obsolete .PHONY declaration

The .PHONY list includes install-kurtosis, but this target has been removed.

Apply this diff to update the .PHONY declarations:

 .PHONY: start-devnet stop-devnet reset-devnet rm-devnet buildifier-install \
   star-lint star-fix start-gcp-devnet-no-build stop-gcp-devnet \
-  reset-gcp-devnet rm-gcp-devnet install-kurtosis
+  reset-gcp-devnet rm-gcp-devnet
📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE

📥 Commits

Reviewing files that changed from the base of the PR and between cafd14e and 564247dcbc9067d86a6031aec876ebc6f4a9fc36.

📒 Files selected for processing (1)
  • kurtosis/Makefile (3 hunks)
🔇 Additional comments (3)
kurtosis/Makefile (3)

11-11: LGTM: Clean dependency update

The dependency change from install-kurtosis to verify-kurtosis-installed aligns with the project's approach of treating kurtosis as a prerequisite.


20-21: LGTM: Helpful operational documentation

Good addition of documentation explaining the purpose of the --production flag in the context of chaos testing.


7-8: Improved kurtosis detection implementation

The new implementation is more robust and cross-platform compatible. The changes address the Ubuntu detection issue by:

  1. Using > /dev/null instead of &> /dev/null
  2. Adding quotes around "kurtosis" to prevent word splitting
  3. Providing clear installation guidance

Let's verify the command works across different shells:

✅ Verification successful

Command verification works consistently across shells

The command command -v "kurtosis" returns expected exit codes across different shells:

  • Exit code 1 in bash: Command not found (expected behavior)
  • Exit code 127 in sh/dash: Command not found (standard behavior for POSIX shells)

These are the expected behaviors when a command is not found, confirming that the implementation will work reliably across different shells to detect missing kurtosis installation.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Test the command in different shells
for shell in bash sh dash; do
    echo "Testing in $shell:"
    $shell -c 'command -v "kurtosis" > /dev/null; echo $?'
done

Length of output: 381

There are two problems here:

1. On Ubuntu, the "command -v kurtosis &> /dev/null" fails to
detect if kurtosis is installed resulting in it trying to install
it again.

2. When extracting the kurtosis.tar.gz artifact it generates a
kurtosis binary in current folder. However we already have a
kurtosis/ folder in our repo so the extraction fails.

This commit fixes 1) so it works on any platform and addresses 2)
by removing the kurtosis automatic installation which should be
fine since its already a prerequisite in our kurtosis/README.md.
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

🧹 Outside diff range comments (1)
kurtosis/Makefile (1)

Line range hint 71-71: Remove 'install-kurtosis' from PHONY targets.

The install-kurtosis target has been removed, but it's still listed in the .PHONY declaration.

Remove it from the PHONY targets list:

.PHONY: start-devnet stop-devnet reset-devnet rm-devnet buildifier-install \
  star-lint star-fix start-gcp-devnet-no-build stop-gcp-devnet \
- reset-gcp-devnet rm-gcp-devnet install-kurtosis
+ reset-gcp-devnet rm-gcp-devnet
📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE

📥 Commits

Reviewing files that changed from the base of the PR and between 564247dcbc9067d86a6031aec876ebc6f4a9fc36 and 8bb57c2.

📒 Files selected for processing (1)
  • kurtosis/Makefile (3 hunks)
🔇 Additional comments (1)
kurtosis/Makefile (1)

11-11: LGTM! Clean dependency change.

The dependency change to verify-kurtosis-installed properly addresses the extraction conflict issue by making kurtosis installation a prerequisite rather than handling it automatically.

Comment on lines -8 to -31
install-kurtosis:
@echo "Checking for Kurtosis installation..."
@if ! command -v kurtosis &> /dev/null; then \
echo "Kurtosis could not be found, installing..."; \
OS=$$(uname -s | tr A-Z a-z); \
if [ "$$OS" = "darwin" ]; then \
brew install kurtosis-tech/tap/kurtosis-cli; \
elif [ "$$OS" = "linux" ]; then \
ARCH=$$(uname -m); \
if [ "$$ARCH" = "x86_64" ]; then ARCH="amd64"; \
elif [ "$$ARCH" = "arm64" ]; then ARCH="arm64"; \
else echo "Unsupported architecture $$ARCH for Kurtosis installation" && exit 1; fi; \
TAG=`curl -s "https://api.github.com/repos/kurtosis-tech/kurtosis-cli-release-artifacts/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/'`; \
curl -Lo kurtosis.tar.gz "https://github.com/kurtosis-tech/kurtosis-cli-release-artifacts/releases/download/$TAG/kurtosis-cli_${TAG}_${OS}_${ARCH}.tar.gz"; \
tar -xzf kurtosis.tar.gz; \
rm kurtosis.tar.gz; \
chmod +x kurtosis; \
sudo mv kurtosis /usr/local/bin/; \
else \
echo "Unsupported OS $$OS for Kurtosis installation" && exit 1; \
fi; \
else \
echo "Kurtosis is already installed"; \
fi
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mentioned during planning today about being fine with fixing the Ubuntu compatibility issue and keeping this install code. I changed my mind as this blob of code is complex and difficult to test and guarantee it works on different platforms. I think we should defer the installation to the user as a prerequisite, its already mentioned in the kurtosis/README.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we collectively decide we wanna get rid of the install code and let the user ensure kurtosis is installed before spinning up the local network, I am okay @abi87 @calbera wanted to know your thoughts

@fridrik01 fridrik01 closed this Feb 4, 2025
@fridrik01
Copy link
Contributor Author

Partly replaced with #2470.

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.

2 participants