I have a user set up on Ubuntu 14.
If I check when logged in as the user
build@linux-build-agent-1:~$ type rvm | head -1 rvm is a function
However, this machine is going to be a teamcity agent...
When a job is run in the context of the teamcity service we see
[13:19:11][Step 1/1] RVM is not a function, selecting rubies with 'rvm use ...' will not work. [13:19:11][Step 1/1] [13:19:11][Step 1/1] You need to change your terminal emulator preferences to allow login shell. [13:19:11][Step 1/1] Sometimes it is required to use `/bin/bash --login` as the command. [13:19:11][Step 1/1] Please visit https://rvm.io/integration/gnome-terminal/ for an example.
I've tried several commands trying to force the service to run in a login shell
su - build -c 'source "$HOME/.rvm/scripts/rvm" && /home/build/buildAgent/bin/agent.sh start' sudo -u build -i bash -lc '/home/build/buildAgent/bin/agent.sh start' su - build -c '/home/build/buildAgent/bin/agent.sh start'
/etc/init.d/ script with no effect.
If I run
source "$HOME/.rvm/scripts/rvm at the head of the script in teamcity then everything is OK but there are multiple users and I can't ask them all to remember to do that.
Is this how I've installed RVM or..?
1) when I'm logged in as the user over SSH rvm is installed correctly and functions as expected. As shown by
type rvm | head -1 => 'rvm is a function'
2) when a service logs in as the user rvm is not working correctly.
I want rvm to work when running in the context of the service so that users don't have to explicitly
source "$HOME/.rvm/scripts/rvm in their build scripts
Typically this issue is caused by not running as a login shell. So I need to know either how to run a service as a login shell. Or how to fangle rvm so that it can work outside of the login shell context