I want to use rvm (or rbenv/chruby for that matter) to select different ruby versions from within my Jenkins jobs. By default, Jenkins will use /bin/sh, which on Ubuntu, is dash.
For this to change, I can add
#!/bin/bash -l
To the top of every single shell execute function everywhere. Seeing as that's a lot of annoying work, I'd like to be able to set that somewhere central.
Using the "Shell executable" configuration setting, I can get it to run bash, adding parameters like '-l' however will fail with
"/bin/bash -l" -xe /tmp/hudson5660076222778817826.sh FATAL: command execution failed java.io.IOException: Cannot run program "/bin/bash -l" (in directory "/home/jenkins/jobs/workspace/rvm-test"): error=2, No such file or directory
I tried using the rvm plugin for jenkins, but that doesn't even install on the current release version.
Any ideas? :)
You could work around by creating a wrapper around bash:
#!/bin/sh
# for ex.: /usr/local/bin/login-bash
exec /bin/bash -l "$@"
If you want to use the default ruby just use the rvm-shell, which comes with rvm. Login as the jenkins user and type:
$ which rvm-shell
/home/jenkins/.rvm/bin/rvm-shell
to get the path of the rvm-shell. Use this path for the "Shell executable" option.