当我尝试通过jenkins构建我的应用程序时,我得到:
+ whoami
jenkins
+ pwd
/var/lib/jenkins/jobs/staging.app.es/workspace
+ bundle install --path vendor/bundle
/tmp/hudson8350518056963795223.sh: 4: /tmp/hudson8350518056963795223.sh: bundle: not found
但是,如果我通过ssh登录我的服务器并执行以下操作:
sudo su jenkins
cd /var/lib/jenkins/jobs/staging.app.es/workspace
bundle install --path vendor/bundle
完美无缺。
我错过了什么????!
我正在使用RVM。 RVM info
显示:
ruby-2.1.0:
system:
uname: "Linux ip-10-165-49-229 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux"
system: "ubuntu/14.04/x86_64"
bash: "/bin/bash => GNU bash, version 4.3.8(1)-release (x86_64-pc-linux-gnu)"
zsh: " => not installed"
rvm:
version: "rvm 1.25.32 (stable) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]"
updated: "1 hour 18 minutes 11 seconds ago"
path: "/var/lib/jenkins/.rvm"
ruby:
interpreter: "ruby"
version: "2.1.0p0"
date: "2013-12-25"
platform: "x86_64-linux"
patchlevel: "2013-12-25 revision 44422"
full_version: "ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-linux]"
homes:
gem: "/var/lib/jenkins/.rvm/gems/ruby-2.1.0"
ruby: "/var/lib/jenkins/.rvm/rubies/ruby-2.1.0"
binaries:
ruby: "/var/lib/jenkins/.rvm/rubies/ruby-2.1.0/bin/ruby"
irb: "/var/lib/jenkins/.rvm/rubies/ruby-2.1.0/bin/irb"
gem: "/var/lib/jenkins/.rvm/rubies/ruby-2.1.0/bin/gem"
rake: "/var/lib/jenkins/.rvm/rubies/ruby-2.1.0/bin/rake"
environment:
PATH: "/var/lib/jenkins/.rvm/gems/ruby-2.1.0/bin:/var/lib/jenkins/.rvm/gems/ruby-2.1.0@global/bin:/var/lib/jenkins/.rvm/rubies/ruby-2.1.0/bin:/var/lib/jenkins/.rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/local/rvm"
GEM_HOME: "/var/lib/jenkins/.rvm/gems/ruby-2.1.0"
GEM_PATH: "/var/lib/jenkins/.rvm/gems/ruby-2.1.0:/var/lib/jenkins/.rvm/gems/ruby-2.1.0@global"
MY_RUBY_HOME: "/var/lib/jenkins/.rvm/rubies/ruby-2.1.0"
IRBRC: "/var/lib/jenkins/.rvm/rubies/ruby-2.1.0/.irbrc"
RUBYOPT: ""
gemset: ""
答案 0 :(得分:3)
我解决了这个问题:
#!/bin/bash -xl
到jenkins shell脚本,它工作正常!
答案 1 :(得分:0)
如果您使用的是某些版本的Ubuntu,则它会将/ bin / sh作为DASH而不是BASH运行。 #!/ bin / bash -xl可以解决问题或sudo dpkg-reconfigure dash然后选择不使用Dash如果你正在运行他在ubuntu上发行