Question

I want to brin one node in slave to offline, i created a job on master and try to send off-line signal to specific node. But i have got authentication problems, what it can be?!

My jenkins job configuration in execute shell:

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

To anonymous grant all security access in Matrix-based security. Mark all points.

Output:

+ 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
Was it helpful?

Solution 3

Have resolved this issue, at first try to login at first, before calling command, but there was no changes, and after that i just create add shh key to jenkins user field and everything is allright.

OTHER TIPS

Read this here, section titled Working with Credentials.

You need to use -i private_key_file unless you have a local private key stored. That key needs to be configured in Jenkins' configuration first

I met the same problem a few days ago. I managed to resolve it by calling the login command first.

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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top