Jenkins脱机节点CLI出现问题

时间:2014-04-28 13:01:46

标签: node.js jenkins jenkins-plugins jenkins-cli

我想让slave中的一个节点脱机,我在master上创建了一个作业,并尝试将离线信号发送到特定节点。但我有身份验证问题,可能是什么?!

我在执行shell中的jenkins作业配置:

wget http://local:8080/jnlpJars/jenkins-cli.jar
java -jar jenkins-cli.jar -s http://local:8080/ who-am-i
java -jar jenkins-cli.jar -s http://local:8080/ offline-node "NSD38" --username admin --password admin

匿名授予基于Matrix的安全性中的所有安全访问权限。标记所有要点。

输出:

+ java -jar jenkins-cli.jar -s http://localhost:8080/ who-am-i
[WARN] Failed to authenticate with your SSH keys. Proceeding as anonymous
Authenticated as: anonymous
Authorities:
anonymous
+ java -jar jenkins-cli.jar -s http://localhost:8080/ offline-node NSD38 --username admin --password  admin
[WARN] Failed to authenticate with your SSH keys. Proceeding as anonymous
java.lang.NullPointerException
at hudson.slaves.OfflineCause$UserCause.<init>(OfflineCause.java:111)
at hudson.slaves.OfflineCause$ByCLI.<init>(OfflineCause.java:128)
at hudson.model.Computer.cliOffline(Computer.java:432)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at hudson.cli.declarative.MethodBinder.call(MethodBinder.java:102)
at hudson.cli.declarative.CLIRegisterer$1.main(CLIRegisterer.java:185)
at hudson.cli.CliManagerImpl.main(CliManagerImpl.java:92)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at hudson.remoting.RemoteInvocationHandler$RPCRequest.perform(RemoteInvocationHandler.java:299)
at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:280)
at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:239)
at hudson.remoting.UserRequest.perform(UserRequest.java:118)
at hudson.remoting.UserRequest.perform(UserRequest.java:48)
at hudson.remoting.Request$2.run(Request.java:328)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
at hudson.cli.CliManagerImpl$1.call(CliManagerImpl.java:63)
at hudson.remoting.InterceptingExecutorService$2.call(InterceptingExecutorService.java:95)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:662)
Build step 'Execute shell' marked build as failure
Notifying upstream projects of job completion
Finished: FAILURE

3 个答案:

答案 0 :(得分:0)

阅读 this here ,标题为使用凭据。

除非您存储了本地私钥,否则您需要使用-i private_key_file。该密钥需要在Jenkins&#39;中配置。首先配置

答案 1 :(得分:0)

我几天前遇到了同样的问题。我设法先通过调用login命令来解决它。

java -jar jenkins-cli.jar -s http://local:8080/ login --username admin --password admin
java -jar jenkins-cli.jar -s http://local:8080/ offline-node "NSD38" --username admin --password admin

答案 2 :(得分:0)

已经解决了这个问题,首先尝试在调用命令之前首先登录,但是没有更改,之后我只是创建了添加shh密钥到jenkins用户字段,一切都很好。