尝试执行jenkins_ssh_slave时出现奇怪错误(jenkins chef cookbook)

时间:2015-02-28 06:51:41

标签: jenkins chef

尝试在以下食谱中将我的jenkins奴隶链接到主人:

jenkins_ssh_slave 'executor' do
  description 'Run test suites'
  remote_fs   '/var/lib/jenkins'
  labels      ['executor', 'freebsd', 'jail']

  # SSH specific attributes
  host        node['slaves']['server']
  user        'jenkins'
end

得到一个奇怪的错误:

 Error executing action `create` on resource 'jenkins_ssh_slave[executor]'
 ================================================================================

 Mixlib::ShellOut::ShellCommandFailed
 ------------------------------------
 Expected process to exit with [0], but received '255'
 ---- Begin output of "java" -jar "/var/chef/cache/jenkins-cli.jar" -s http://localhost:8080 groovy /tmp/groovy20150228-1651-1ax6nby ----
 STDOUT: 
 STDERR: groovy.lang.GroovyRuntimeException: Ambiguous method overloading for method hudson.plugins.sshslaves.SSHLauncher#<init>.
 Cannot resolve which method to invoke for [class java.lang.String, class java.lang.Integer, null, null, null, null, null] due to overlapping prototypes between:
    [class java.lang.String, int, interface com.cloudbees.plugins.credentials.common.StandardUsernameCredentials, class java.lang.String, class java.lang.String, class java.lang.String, class java.lang.String]
    [class java.lang.String, int, interface com.cloudbees.jenkins.plugins.sshcredentials.SSHUser, class java.lang.String, class java.lang.String, class java.lang.String, class java.lang.String]
    at groovy.lang.MetaClassImpl.chooseMostSpecificParams(MetaClassImpl.java:2922)
    at groovy.lang.MetaClassImpl.chooseMethodInternal(MetaClassImpl.java:2875)
    at groovy.lang.MetaClassImpl.chooseMethod(MetaClassImpl.java:2816)
    at groovy.lang.MetaClassImpl.createConstructorSite(MetaClassImpl.java:3065)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.createCallConstructorSite(CallSiteArray.java:75)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:54)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182)
    at RemoteClass.run(RemoteClass:64)
    at groovy.lang.GroovyShell.runScriptOrMainOrTestOrRunnable(GroovyShell.java:266)
    at groovy.lang.GroovyShell.run(GroovyShell.java:517)
    at hudson.cli.GroovyCommand.run(GroovyCommand.java:94)
    at hudson.cli.CLICommand.main(CLICommand.java:237)
    at hudson.cli.CliManagerImpl.main(CliManagerImpl.java:92)
    at sun.reflect.GeneratedMethodAccessor180.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at hudson.remoting.RemoteInvocationHandler$RPCRequest.perform(RemoteInvocationHandler.java:326)
    at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:301)
    at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:260)
    at hudson.remoting.UserRequest.perform(UserRequest.java:121)
    at hudson.remoting.UserRequest.perform(UserRequest.java:49)
    at hudson.remoting.Request$2.run(Request.java:324)
    at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
    at hudson.cli.CliManagerImpl$1.call(CliManagerImpl.java:63)
    at hudson.remoting.CallableDecoratorAdapter.call(CallableDecoratorAdapter.java:18)
    at hudson.remoting.CallableDecoratorList$1.call(CallableDecoratorList.java:21)
    at jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:46)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)
 ---- End output of "java" -jar "/var/chef/cache/jenkins-cli.jar" -s http://localhost:8080 groovy /tmp/groovy20150228-1651-1ax6nby ----
 Ran "java" -jar "/var/chef/cache/jenkins-cli.jar" -s http://localhost:8080 groovy /tmp/groovy20150228-1651-1ax6nby returned 255

 Cookbook Trace:
 ---------------
 /var/chef/cache/cookbooks/jenkins/libraries/_executor.rb:82:in `execute!'
 /var/chef/cache/cookbooks/jenkins/libraries/_executor.rb:127:in `groovy!'
 /var/chef/cache/cookbooks/jenkins/libraries/slave.rb:149:in `block in action_create'
 /var/chef/cache/cookbooks/jenkins/libraries/slave.rb:148:in `action_create'

 Resource Declaration:
 ---------------------
 # In /var/chef/cache/cookbooks/solum-jenkins/recipes/slaves.rb

   1: jenkins_ssh_slave 'executor' do
   2:   description 'Run test suites'
   3:   remote_fs   '/var/lib/jenkins'
   4:   labels      ['executor', 'freebsd', 'jail']
   5: 
   6:   # SSH specific attributes
   7:   host        node['slaves']['server']
   8:   user        'jenkins'
   9: end

不确定我做错了什么,谷歌/ stackoverflow搜索没有帮助所以我觉得我错过了一些非常愚蠢的东西!

1 个答案:

答案 0 :(得分:0)

你能抓住它试图执行的tmp groovy脚本吗?我刚刚遇到与hudson.plugins.active_directory.ActiveDirectorySecurityRealm类相似的错误。

当我初始化类时,我没有提供正确的值,基本上它找不到正确的模式来初始化。