0

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

我在执行 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

在基于矩阵的安全中匿名授予所有安全访问权限。标记所有点。

输出:

+ 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
4

3 回答 3

0

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

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
于 2014-04-30T05:00:06.657 回答
0

在此处阅读标题为“使用凭据”的部分。

-i private_key_file除非您存储了本地私钥,否则您需要使用。那个key需要先在Jenkins的配置中配置

于 2014-04-28T13:18:19.357 回答
0

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

于 2014-05-02T09:57:20.820 回答