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

Errors on non circle images - runs as root and sources wrong bash profile #69

Open
kieran-osgood opened this issue May 20, 2021 · 0 comments
Labels
backlog Identified as a backlog item, often combined with low-priority and help-wanted labels bug Something isn't working

Comments

@kieran-osgood
Copy link

Orb version:

0.2.2

What happened:

There's seems to be an issue with the installation when using non-circle provided images as it will attempt to source the bash profile from root providing this error:

rvm install 2.7
rvm use 2.7
echo . $(rvm 2.7 do rvm env --path) >> $BASH_ENV

/tmp/.bash_env-60a2b2cc3b59b77b9bec7a64-0-build: line 2: /root/.rvm/scripts/rvm: No such file or directory
/bin/bash: rvm: command not found

Exited with code exit status 127

I'd contacted circle support and this was the response:

I believe the issue here with RVM is that the installation is run as the root as opposed to an unprivileged user or with sudo. The Orb does not appear to account for that. I've created a custom run step based on the Orb that should get RVM installed and running on that image. I also removed a few parts for brevity.

      - run: |
          # Disable IPv6
          mkdir -p ~/.gnupg/
          find ~/.gnupg -type d -exec chmod 700 {} \;
          echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf
          until gpg --keyserver hkp://ipv4.pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
          curl -sSL "https://get.rvm.io" | bash -s stable
          # this should be what needs to be added to that $BASH_ENV since this is what's in bash_profile - i dont know when $HOME is set
          echo "source /etc/profile.d/rvm.sh" >> $BASH_ENV
          # this will source if anyone logs in noninteractively, nvm setup only adds nvm to the path, to get the rubygems later you need to source this again
          echo "source /etc/profile.d/rvm.sh" >> .bashrc
      - run: |
          rvm install 2.7
          rvm use 2.7
The only thing that actually needed to change here was the source commands. The Orb makes use of the following based upon a user install:

echo "source $HOME/.rvm/scripts/rvm" >> $BASH_ENV
echo "source $HOME/.rvm/scripts/rvm" >> ~/.bashrc
I changed that to make use of the multi-user installation location for RVM:

echo "source /etc/profile.d/rvm.sh" >> $BASH_ENV
echo "source /etc/profile.d/rvm.sh" >> .bashrc

Expected behavior:

Conditional logic to select the correct bash profile and run it at such

@kieran-osgood kieran-osgood added the bug Something isn't working label May 20, 2021
@Jaryt Jaryt added the backlog Identified as a backlog item, often combined with low-priority and help-wanted labels label Oct 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog Identified as a backlog item, often combined with low-priority and help-wanted labels bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants