我正在从詹金斯那里经营这项工作,并且经常失败......
Started by user anonymous
Building in workspace /var/lib/jenkins/jobs/deploy-mapreduce/workspace
Capturing environment variables produced by 'rvm use ruby-1.9.3-p484'
$ 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 ruby-1.9.3-p484 && export > rvm.env"
Using /usr/local/rvm/gems/ruby-1.9.3-p484
[workspace] $ ruby -v /tmp/hudson4593249725887441871.rb
FATAL: command execution failed
java.io.IOException: Cannot run program "ruby" (in directory "/var/lib/jenkins/jobs/deploy-mapreduce/workspace"): java.io.IOException: error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:460)
at hudson.Proc$LocalProc.<init>(Proc.java:244)
at hudson.Proc$LocalProc.<init>(Proc.java:216)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:773)
at hudson.Launcher$ProcStarter.start(Launcher.java:353)
at hudson.Launcher$ProcStarter.join(Launcher.java:360)
at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:94)
at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:63)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:785)
at hudson.model.Build$BuildExecution.build(Build.java:199)
at hudson.model.Build$BuildExecution.doRun(Build.java:160)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:566)
at hudson.model.Run.execute(Run.java:1677)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:231)
Caused by: java.io.IOException: java.io.IOException: error=2, No such file or directory
at java.lang.UNIXProcess.<init>(UNIXProcess.java:148)
at java.lang.ProcessImpl.start(ProcessImpl.java:65)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:453)
... 16 more
但是我可以从shell运行一个测试ruby文件,它可以正常工作
[root@jenkins01 etc]# su -c " source /usr/local/rvm/scripts/rvm && rvm use --install --create ruby-1.9.3-p484 && export > rvm.env ; ruby -v /tmp/test.rb" -s /bin/bash jenkins
Using /usr/local/rvm/gems/ruby-1.9.3-p484
ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]
hello
我认为它缺少这个文件......“/ tmp / hudson4593249725887441871.rb”但是作为用户“jenkins”我可以在/ tmp目录中创建文件很好....
问题出在哪里?
答案 0 :(得分:1)
堆栈跟踪基本上意味着Jenkins启动的构建过程无法找到ruby可执行文件。
如果可以,请使用RVM Jenkins plugin。它:
运行整个构建(从SCM签出到构建后的操作) 在您选择的RVM托管环境的上下文中(如 反对你做“源〜/ .rvm / scripts / rvm&amp;&amp; rvm foo @ bar”, 这只影响你当前的shell)
如果Ruby / gemset你 在构建正在运行的从属服务器上不存在指定的,它将是 自动安装和创建(通过rvm_install_on_use_flag)