Jenkins is running on an ubuntu machine. It has a special user jenkins which is used for executing the jobs.
RVM is installed and in an ssh shell on the server, logged in as the jenkins user, everything works fine.(If I set RVM to use ruby 1.9.3 ruby -vreturns 1.9.3 as version)
I use the RVM-plugin for Jenkins and have set it to use 1.9.3
Output by Jenkins for RVM:
Capturing environment variables produced by 'rvm use 1.9.3'
$ bash -c export
$ bash -c "test -f ~/.rvm/scripts/rvm"
$ bash -c "test -f /usr/local/rvm/scripts/rvm"
[workspace] $ bash -c " source /usr/local/rvm/scripts/rvm && rvm use --install --create 1.9.3 && export > rvm.env"
Using /usr/local/rvm/gems/ruby-1.9.3-p0
However if I later want to execute my script it uses ruby version 1.8.7.
Output for ruby version and environment:
+ which ruby
/usr/bin/ruby
+ ruby -v
ruby 1.8.7 (2010-01-10 patchlevel 249) [i486-linux]
+ rvm info
ruby-1.9.3-p0:
system:
uname: "Linux h1332957.stratoserver.net 2.6.32-042stab078.27 #1 SMP Mon Jul 1 20:48:07 MSK 2013 i686 GNU/Linux"
bash: "/bin/bash => GNU bash, version 4.1.5(1)-release (i486-pc-linux-gnu)"
zsh: " => not installed"
rvm:
version: "rvm 1.9.2 by Wayne E. Seguin ([email protected] [https://rvm.beginrescueend.com/]"
ruby:
interpreter: "ruby"
version: "1.8.7"
date: "2010-01-10"
platform: "i486-linux"
patchlevel: "2010-01-10 patchlevel 249"
full_version: "ruby 1.8.7 (2010-01-10 patchlevel 249) [i486-linux]"
homes:
gem: "/usr/local/rvm/gems/ruby-1.9.3-p0"
ruby: "/usr/local/rvm/rubies/ruby-1.9.3-p0"
binaries:
ruby: "/usr/bin/ruby"
irb: "/usr/bin/irb"
gem: "/usr/bin/gem"
rake: "/usr/bin/rake"
environment:
PATH: "/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/usr/local/rvm/bin:/usr/local/rvm/bin"
GEM_HOME: "/usr/local/rvm/gems/ruby-1.9.3-p0"
GEM_PATH: "/usr/local/rvm/gems/ruby-1.9.3-p0:/usr/local/rvm/gems/ruby-1.9.3-p0@global"
MY_RUBY_HOME: "/usr/local/rvm/rubies/ruby-1.9.3-p0"
IRBRC: "/usr/local/rvm/rubies/ruby-1.9.3-p0/.irbrc"
RUBYOPT: ""
gemset: ""
Question:
How can I make Jenkins use ruby version 1.9.3 instead?