Any suggestions/fixes for this jenkins-cli error?
I have a deploy job, which is parameterized (test, stage, prod). So, whenever there is a deploy to the "staging" environment, i am trying to make Jenkins slaves execute a groovy script. Trying to test the jenkins-cli.jar, i got this error:
[jenkins@ip-10-0-0-92 scripts]$ java -jar jenkins-cli.jar -s https://my_jenkins_URL/ help
Exception in thread "main" java.net.SocketTimeoutException: connect timed out
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:579)
at hudson.cli.CLI.connectViaCliPort(CLI.java:203)
at hudson.cli.CLI.<init>(CLI.java:126)
at hudson.cli.CLIConnectionFactory.connect(CLIConnectionFactory.java:72)
at hudson.cli.CLI._main(CLI.java:466)
at hudson.cli.CLI.main(CLI.java:382)
Suppressed: java.io.EOFException: unexpected stream termination
at hudson.remoting.ChannelBuilder.negotiate(ChannelBuilder.java:331)
at hudson.remoting.Channel.<init>(Channel.java:421)
at hudson.remoting.Channel.<init>(Channel.java:400)
at hudson.remoting.Channel.<init>(Channel.java:396)
at hudson.remoting.Channel.<init>(Channel.java:385)
at hudson.remoting.Channel.<init>(Channel.java:377)
at hudson.remoting.Channel.<init>(Channel.java:353)
at hudson.cli.CLI.connectViaHttp(CLI.java:157)
at hudson.cli.CLI.<init>(CLI.java:130)
... 3 more
I have done:
- Set a fixed port for TCP/IP port for CLI and slaves & its listening on the master server
- All ports are open between the jenkins nodes
- Went through https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+CLI
I am using nginx with valid SSL cert.
PS: i came accross the below 2 questions. they are close but none have a solution and the issues are unique in its own ways.
How to have jenkins-cli.jar work with Jenkins running https? Jenkins CLI with HTTPS
I got the same error and fixed it by adding a new entry in /etc/hosts file.
The line I added is:
The issue is that the slave couldn't resolve the Jenkins master. This has been happening since I set up a new server for my Jenkins master.