0

When I try to run my cucumber scripts (or RVM/Ruby/Bundle) on Jenkins, I get the following error (command not found):

Started by user anonymous
Building in workspace /Users/Shared/Jenkins/Home/jobs/Testing/workspace
[workspace] $ /bin/sh -xe /Users/Shared/Jenkins/tmp/hudson6097735085503119949.sh
+ cucumber features/scheduling/scheduling_nonlive/schedule_page.feature --line 4 --format json -o cucumber.json
/Users/Shared/Jenkins/tmp/hudson6097735085503119949.sh: line 2: cucumber: command not found
Build step 'Execute shell' marked build as failure

After Googling, I'm fairly confident is has to do with some RVM and PATH/permissions problems from Jenkins. How do I change the PATH so Jenkins can use the same PATH that I use?

~% which cucumber
/Users/fyousuf/.rvm/gems/ruby-2.0.0-p247/bin/cucumber

~/.jenkins% pwd
/Users/fyousuf/.jenkins

~/.jenkins% which rvm
/Users/fyousuf/.rvm/bin/rvm

~/.jenkins% which ruby
/Users/fyousuf/.rvm/rubies/ruby-2.0.0-p247/bin/ruby

My ~/.bashrc contains:

PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting

My .bash_profile:

 PATH=/usr/local/bin:/usr/local/mysql/bin:/usr/local/jruby-1.7.5/bin:$PATH
 [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*

Has anyone run into a similar issue and knew how to solve it?

Farooq
  • 1,925
  • 3
  • 15
  • 36

1 Answers1

-1

use this path for cucumber:

/Users/fyousuf/.rvm/wrappers/ruby-2.0.0-p247/cucumber
mpapis
  • 52,729
  • 14
  • 121
  • 158
  • Where should I put that? – Farooq May 29 '14 at 16:08
  • Also it's not just Cucumber that doesn't work, other things like "rvm list" or "bundle" don't work, "ruby -v" gives a different version of Ruby than my dev env. – Farooq May 29 '14 at 16:16
  • you use `sh` shell which is not supported by rvm, try instead `/bin/bash -l /Users/Shared/Jenkins/tmp/hudson6097735085503119949.sh` or show the script that gets run. – mpapis May 29 '14 at 17:21
  • for the ruby installation, try rerunning it, and for the script - I need to see it, without seeing it it's hard to tell how to fix it – mpapis May 29 '14 at 17:52
  • Hmmm...I'm thinking the solution has to do with http://stackoverflow.com/questions/10209242/rvm-and-jenkins-setup or http://stackoverflow.com/questions/10365792/cant-run-jenkins-build-bundle-command-not-found, but not sure what to change in my environment.... – Farooq May 29 '14 at 18:00