Skip to content

feat(base): autoload bash env for other shells #983

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

Closed
wants to merge 1 commit into from

Conversation

axonasif
Copy link
Member

@axonasif axonasif commented Nov 25, 2022

Description

This adds startup scripts specific to fish and zsh to autoload the bash environment variables within their sessions without altering the user configuration (i.e. dotfiles)

Related Issue(s)

Fixes gitpod-io/gitpod#10105

How to test

Screenshot 2022-11-25 at 3 36 29 PM

Open this PR on Gitpod.

Build and run:

cd base
docker build -t base . && docker run -it base

We will land in a bash shell. Now we can create a script inside ~/.bashrc.d from the bash session and then switch to another shell to test if it picked it up.

echo 'export TESTVAR=hello' > ~/.bashrc.d/testing

# Switch to fish
fish

# Check the variable
echo $TESTVAR

# Exit
exit

# Switch to zsh
zsh

# Check
echo $TESTVAR

# Exit
exit

# We'll be back on `bash` (however, it didn't pick up `~/.bashrc.d/testing`, because it was created during the session)
echo $TESTVAR # will be empty
# let's check in `env` as well
env | grep TESTVAR # will be empty

# Now let's reload bash session
exec bash -l

# Now it should be available on bash as well
env | grep TESTVAR

Release Notes

Documentation

@axonasif axonasif requested review from a team November 25, 2022 09:49
@axonasif
Copy link
Member Author

axonasif commented Nov 25, 2022

This could be implemented via supervisor as well, we just need to write two files, that could be helpful if someone is using a non-gitpod image.

@axonasif axonasif force-pushed the axonasif/autoload_bash branch from 800e2f8 to 6212d49 Compare November 25, 2022 10:00
@gitpod-io
Copy link

gitpod-io bot commented Nov 25, 2022

@axonasif axonasif force-pushed the axonasif/autoload_bash branch from 6212d49 to 7df7b16 Compare November 25, 2022 10:01
@axonasif axonasif force-pushed the axonasif/autoload_bash branch from 7df7b16 to 8740e71 Compare November 25, 2022 10:02
@axonasif axonasif marked this pull request as draft November 25, 2022 10:59
@axonasif
Copy link
Member Author

Converted to draft.
Context here.

@axonasif axonasif closed this Nov 25, 2022
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.

Epic: Improved support for user-defined shells (e.g. fish / zsh, etc)
1 participant