本文介绍了取得"无法运行程序"bash".在詹金斯(Jenkins)建立厨师时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在jenkins中安装了Chef-plugin,并进行了以下配置:在远程主机上运行Chef客户端:

I have installed chef-plugin in jenkins and did the following configurations:Run chef client on remote host:

enabled: checked
ssh host: "remote host"
ssh login: root
chef_json template: "{
  "run-list" :[
   "recipe[test]"
   ]
}"

color output: checked

,并出现以下错误:

Started by user swetha sreeramoju
Building in workspace C:\.jenkins\workspace\chef-sample
[2015-05-27 19:06:44 +0530] INFO: [34m[47mrendering ERB template[0m[0m
[2015-05-27 19:06:44 +0530] INFO: [34m[47mparsing JSON string[0m[0m
[2015-05-27 19:06:44 +0530] INFO: [34m[47msaving JSON to file[0m[0m
[2015-05-27 19:06:44 +0530] INFO: [2m[1m[34m[47m[4mchef json url[0m[0m[0m[0m[0m[34m[47m : http://localhost:8080/jenkins//job/chef-sample/ws/chef.json[0m[0m
[2015-05-27 19:06:44 +0530] INFO: [2m[1m[34m[47m[4mhost[0m[0m[0m[0m[0m[34m[47m : 10.0.12.209[0m[0m
$ bash -c "ssh root@10.0.12.209 sudo chef-client -l info -j http://localhost:8080/jenkins//job/chef-sample/ws/chef.json  "
ERROR: Cannot run program "bash": CreateProcess error=2, The system cannot find the file specified (Java::JavaIo::IOException)
java.lang.ProcessBuilder.start(Unknown Source)
hudson.Proc$LocalProc.<init>(Proc.java:244)
hudson.Proc$LocalProc.<init>(Proc.java:216)
hudson.Launcher$LocalLauncher.launch(Launcher.java:816)
hudson.Launcher$ProcStarter.start(Launcher.java:382)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
java.lang.reflect.Method.invoke(Unknown Source)
org.jruby.javasupport.JavaMethod.invokeDirectWithExceptionHandling(JavaMethod.java:440)
org.jruby.javasupport.JavaMethod.invokeDirect(JavaMethod.java:304)
org.jruby.java.invokers.InstanceMethodInvoker.call(InstanceMethodInvoker.java:52)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:134)
org.jruby.ast.CallNoArgNode.interpret(CallNoArgNode.java:64)
org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57)
org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:75)
org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:112)
org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:126)
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:163)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:70)
org.jruby.ast.FCallSpecialArgNode.interpret(FCallSpecialArgNode.java:45)
org.jruby.ast.CallNoArgNode.interpret(CallNoArgNode.java:64)
org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:75)
org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:112)
org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:126)
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:163)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:70)
org.jruby.ast.CallManyArgsNode.interpret(CallManyArgsNode.java:59)
org.jruby.ast.CallOneArgFixnumNode.interpret(CallOneArgFixnumNode.java:59)
org.jruby.ast.IfNode.interpret(IfNode.java:110)
org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
org.jruby.ast.IfNode.interpret(IfNode.java:116)
org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:75)
org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:268)
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:220)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:236)
org.jruby.ast.CallThreeArgNode.interpret(CallThreeArgNode.java:61)
org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
org.jruby.evaluator.ASTInterpreter.INTERPRET_BLOCK(ASTInterpreter.java:112)
org.jruby.runtime.Interpreted19Block.evalBlockBody(Interpreted19Block.java:209)
org.jruby.runtime.Interpreted19Block.yield(Interpreted19Block.java:160)
org.jruby.runtime.Interpreted19Block.yieldSpecific(Interpreted19Block.java:133)
org.jruby.runtime.Block.yieldSpecific(Block.java:99)
org.jruby.ast.ZYieldNode.interpret(ZYieldNode.java:25)
org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
org.jruby.ast.RescueNode.executeBody(RescueNode.java:224)
org.jruby.ast.RescueNode.interpret(RescueNode.java:119)
org.jruby.ast.BeginNode.interpret(BeginNode.java:83)
org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:75)
org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:204)
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:196)
org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:177)
org.jruby.runtime.callsite.CachingCallSite.callIter(CachingCallSite.java:188)
org.jruby.ast.FCallOneArgBlockNode.interpret(FCallOneArgBlockNode.java:34)
org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:75)
org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:112)
org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:126)
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:163)
org.jruby.javasupport.proxy.JavaProxyConstructor$2.invoke(JavaProxyConstructor.java:224)
org.jruby.proxy.hudson.tasks.Builder$Proxy2.perform(Unknown Source)
hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:764)
hudson.model.Build$BuildExecution.build(Build.java:205)
hudson.model.Build$BuildExecution.doRun(Build.java:162)
hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:537)
hudson.model.Run.execute(Run.java:1744)
hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
hudson.model.ResourceController.execute(ResourceController.java:98)
hudson.model.Executor.run(Executor.java:374)

Build step 'Run chef client on remote host' marked build as failure
Finished: FAILURE

Chef客户端和服务器在Linux机器上运行,而jenkins在Windows7中配置.

Chef client and server is running in Linux machine, and jenkins is configured in Windows7.

推荐答案

那没有道理.

  • 什么是"Jenkins客户"?您用来连接到Jenkins的浏览器?您可以通过任何操作系统上的任何浏览器进行连接.它对执行没有任何影响.执行在主/从节点上进行.
  • "Jenkins服务器正在Linux中运行".好的.但是,为什么您的日志显示Building in workspace C:\.jenkins\workspace\chef-sample.显然,它正在Windows节点上运行.因此,或者您没有提到Windows从属节点,或者Jenkins服务器不在Linux上,而是在Windows上.
  • "Jenkins在Windows7中配置".好吧,这只会继续增加混乱.是在Windows还是Linux上运行的Jenkins服务器,您在前面的句子中刚刚说了"Linux".
  • What's "Jenkins client"? The browser that you used to connect to Jenkins? You can connect through any browser on any OS. It has no affect whatsoever on the execution. The execution happens on master/slave nodes.
  • "Jenkins [...] server is running in Linux". OK. But then why does your log say Building in workspace C:\.jenkins\workspace\chef-sample. Clearly it is running on Windows node. So either there is a Windows slave node that you are not mentioning, or the Jenkins server is not on Linux but on Windows.
  • "Jenkins is configured in Windows7". Well, that just continues to add to the confusion. Is Jenkins server running on Windows or Linux, you just said "Linux" in the previous sentence.

您的问题是,除非您在Windows上安装了bash等效版本(Cygwin),否则您将无法在Windows上的Jenkins中运行bash(并且所有情况都指向此处).

Your issue is that you cannot run bash in Jenkins on Windows (and everything points to that being the case here), unless you have a bash equivalent (Cygwin) installed on Windows

这篇关于取得&quot;无法运行程序"bash".在詹金斯(Jenkins)建立厨师时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 02:05