gpt4 book ai didi

linux - Jenkins 无法运行程序 "ruby"没有那个文件或目录

转载 作者:太空狗 更新时间:2023-10-29 12:33:03 25 4
gpt4 key购买 nike

我正在从 jenkins 运行这项工作,但它经常失败......

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 目录中创建文件...

知道问题出在哪里吗?

最佳答案

堆栈跟踪基本上意味着 Jenkins 启动的构建过程找不到 ruby​​ 可执行文件。

使用RVM Jenkins plugin如果你可以的话。它:

Runs your entire build (from SCM check out to post-build actions)within the context of an RVM managed environment of your choice (asopposed to your doing "source ~/.rvm/scripts/rvm && rvm foo@bar",which only affects your current shell)

If the Ruby/gemset youspecified doesn't exist on a slave that the build is running, it'll beautomatically installed and created (via rvm_install_on_use_flag)

关于linux - Jenkins 无法运行程序 "ruby"没有那个文件或目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21019050/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com