【问题标题】:Jenkins off-line node CLI troublesJenkins离线节点CLI问题
【发布时间】:2014-06-14 01:06:46
【问题描述】:

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

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

【问题讨论】:

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


    【解决方案1】:

    阅读 this here,标题为使用凭证的部分。

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

    【讨论】:

    • 但是如果它尝试像匿名一样登录它为什么不这样做呢?
    • 因为您的服务器配置可能不允许anonymous 用户进行此类更改。您可以随时尝试在 Jenkins 配置中关闭身份验证并选择 Everyone can do anything,然后再次尝试您的命令行。
    • 已经按照你说的做了并且没有改变(构建失败并出现同样的问题
    【解决方案2】:

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

    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
    

    【讨论】:

      【解决方案3】:

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-07-30
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-11-08
        相关资源
        最近更新 更多