jenkins-cli commands returning connect timed out

蓝咒 提交于 2019-12-11 03:45:47

问题


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:

  1. Set a fixed port for TCP/IP port for CLI and slaves & its listening on the master server
  2. All ports are open between the jenkins nodes
  3. 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


回答1:


I got the same error and fixed it by adding a new entry in /etc/hosts file.

The line I added is:

10.0.0.11 jenkins.xxxxx.com

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.



来源:https://stackoverflow.com/questions/31712023/jenkins-cli-commands-returning-connect-timed-out

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!