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 bazel installation for github codespace #49472

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dentiny
Copy link
Contributor

@dentiny dentiny commented Dec 28, 2024

Fix issue: #49470

The problem is: not all the platform defaults binary installation to default system executable path, so we have to append them manually to the PATH.

@dentiny dentiny force-pushed the hjiang/fix-github-codespace-install branch from 34b6a39 to 82c5d3f Compare December 28, 2024 08:37
@dentiny dentiny requested review from pcmoritz and jjyao December 28, 2024 08:38
@dentiny dentiny added the go add ONLY when ready to merge, run all tests label Dec 28, 2024
@dentiny dentiny force-pushed the hjiang/fix-github-codespace-install branch 2 times, most recently from d34ea2f to b08f55f Compare December 30, 2024 04:50
@@ -95,6 +95,10 @@ fi

bazel --version
Copy link
Collaborator

Choose a reason for hiding this comment

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

If this line works then this means it's part of path already? Seems our installation target is bin/ folder?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, checkout the issue linked; I'm interested in this issue since I met the same issue when I was using github codespace.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Executable accessible could be installed in the current directory.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Don't we always install to target="$HOME/bin/bazel" or target="/bin/bazel"

Copy link

Choose a reason for hiding this comment

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

For me particularly,

@SaSikun ➜ /workspaces/ray (master) $ echo $HOME
/home/codespace

+ bazel --version
bazel 6.5.0
+ which bazel
/home/codespace/bin/bazel

And bazel does install under $HOME/bin/bazel, but it's not in PATH

@dentiny dentiny requested a review from jjyao December 30, 2024 06:24
@dentiny dentiny force-pushed the hjiang/fix-github-codespace-install branch from b08f55f to ce2c12d Compare December 30, 2024 19:05

# Append bazel executable directory to system `PATH`.
BAZEL_EXEC_BIN=$(dirname "$(which bazel)")
echo "export PATH=${BAZEL_EXEC_BIN}:\$PATH" >> ~/.bashrc
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure if it's good idea to change user's .bashrc. Should we instead update the doc instead telling people to put the installation path to the PATH?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure that's good!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

TBH I still prefer to add it into system executable path, and it's commonly used in a lot of tools that I use:

[ -f ~/.fzf.bash ] && source ~/.fzf.bash
eval "$(thefuck --alias)"

Copy link
Collaborator

Choose a reason for hiding this comment

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

I feel it might have unintended side effect: at least we should do PATH=:$PATH:${BAZEL_EXEC_BIN} instead of PATH=${BAZEL_EXEC_BIN}:\$PATH

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Emm I don't see much difference? Just search order. BTW in the latest commit there's only Readme doc change but no code change

@dentiny dentiny requested a review from a team as a code owner December 31, 2024 06:16
@dentiny dentiny requested a review from jjyao December 31, 2024 06:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
go add ONLY when ready to merge, run all tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants