Jenkins使用gem生成失败:未找到命令

Jenkins使用gem生成失败:未找到命令,jenkins,continuous-integration,Jenkins,Continuous Integration,我正在尝试设置jenkins,但在执行shell部分一直失败 我得到以下错误: /tmp/hudson1424221209017954242.sh: line 8: gem: command not found /tmp/hudson1424221209017954242.sh: line 9: bundle: command not found /tmp/hudson1424221209017954242.sh: line 12: bundle: command not found 我已经在

我正在尝试设置jenkins,但在执行shell部分一直失败

我得到以下错误:

/tmp/hudson1424221209017954242.sh: line 8: gem: command not found
/tmp/hudson1424221209017954242.sh: line 9: bundle: command not found
/tmp/hudson1424221209017954242.sh: line 12: bundle: command not found
我已经在/usr/local/rvm/上设置了rvm全局。存储jenkins的用户jenkins可以通过ssh运行bundle

以下是执行shell命令:

#!/bin/bash
source /var/lib/jenkins/.bashrc
# enter application root
cd /var/lib/jenkins/jobs/topboard/workspace
# install missing gems
rvm use 2.1.2@gemset --create
# set env vars
gem install bundler
bundle install
export RAILS_ENV=test
# invoke rake
bundle exec rake db:create db:migrate ci:setup:rspec

谢谢

我认为这将是一个RVM安装问题-您是如何安装RVM的?它是否包含在路径中?它应该包含在~/.bash_profile、~/.profile和~/.bashrc中,以便在交互式和非交互式shell会话中都可用。我在VPS实例中全局安装了它。在这种情况下,我是否需要在用户自身中重新安装它?或者我可以通过.bash_profile进行引导吗?如果按照RVM文档中的说明,以多用户模式全局安装RVM,则必须将要使用RVM的每个用户添加到RVM组中。RVM安装应创建一个名为RVM的操作系统组-您应将用户添加到此组中。您可以在官方RVM安装文档页面上找到有关多用户模式的更多信息:-搜索多用户-尤其是将RVM作为功能部分加载到shell会话中