我正在尝试从jenkins shell运行ruby文件。 我在jenkins shell-
中写了以下命令cd /home/user/Desktop/Rubyfolder
ruby test.rb
但是当我运行构建时,它返回错误:
+ cd /home/user/Desktop/Rubyfolder
+ ruby test.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- rest_client (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /home/user/Desktop/RubyScript/api_url.rb:2:in `<top (required)>'
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from test.rb:1:in `<main>'
Build step 'Execute shell' marked build as failure
Finished: FAILURE
当我从系统控制台运行它时,它正在返回成功。
请帮忙。提前致谢。
答案 0 :(得分:0)
看起来詹金斯并没有加载安装Gem的RVM环境。查看有关集成它的RVM's instructions。还有plugin可能会有所帮助。
摘要步骤如下:
jenkins
用户source "$HOME/.rvm/scripts/rvm"
jenkins
.bashrc
rvm use ruby_version[@gemset]
rvm rubyversion[@gemset] do <command>