I'm having an issue with executing a bash script from within jenkins. I have the shell command checked and my inputs are as follows:
rvm use jruby-1.7.4
export JRUBY_OPTS=--1.8
jruby -S cucumber
FYI: those 3 commands are exactly what I type in the terminal when launching cucumber outside of Jenkins.
When I execute those commands, this is my output
[workspace] $ /bin/sh -xe /home/nwssc/apache-tomcat-7.0.40/temp/hudson7305254619895710829.sh
+ rvm use jruby-1.7.4
RVM is not a function, selecting rubies with 'rvm use ...' will not work.
You need to change your terminal emulator preferences to allow login shell.
Sometimes it is required to use `/bin/bash --login` as the command.
Please visit https://rvm.io/integration/gnome-terminal/ for a example.
+ export JRUBY_OPTS=--1.8
+ jruby -S cucumber
/home/nwssc/apache-tomcat-7.0.40/temp/hudson7305254619895710829.sh: 4: /home/nwssc/apache-tomcat-7.0.40/temp/hudson7305254619895710829.sh: jruby: not found
Build step 'Execute shell' marked build as failure
Finished: FAILURE
So I execute with the /bin/bash --login as the first command to my script and I still get
[workspace] $ /bin/sh -xe /home/nwssc/apache-tomcat-7.0.40/temp/hudson7981126593924329573.sh
+ /bin/bash --login
+ rvm use jruby-1.7.4
RVM is not a function, selecting rubies with 'rvm use ...' will not work.
You need to change your terminal emulator preferences to allow login shell.
Sometimes it is required to use `/bin/bash --login` as the command.
Please visit https://rvm.io/integration/gnome-terminal/ for a example.
+ export JRUBY_OPTS=--1.8
+ jruby -S cucumber
/home/nwssc/apache-tomcat-7.0.40/temp/hudson7981126593924329573.sh: 5: /home/nwssc/apache-tomcat-7.0.40/temp/hudson7981126593924329573.sh: jruby: not found
Build step 'Execute shell' marked build as failure
So I tried using the RVM plugin and setting it to use jruby 1.7.4 and this is the result
Capturing environment variables produced by 'rvm use jruby-1.7.4'
$ 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 jruby-1.7.4 && export > rvm.env"
Using /usr/local/rvm/gems/jruby-1.7.4
[workspace] $ /bin/sh -xe /home/nwssc/apache-tomcat-7.0.40/temp/hudson661746741998327634.sh
+ export JRUBY_OPTS=--1.8
+ jruby -S cucumber
/home/nwssc/apache-tomcat-7.0.40/temp/hudson661746741998327634.sh: 3: /home/nwssc/apache-tomcat-7.0.40/temp/hudson661746741998327634.sh: jruby: not found
Build step 'Execute shell' marked build as failure
What am I doing wrong and how do I fix this?