Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

force jenkins slave to use internal host?

Tags:

jenkins

How do i force a jenkins slave to connect to an internal host name via its run command for the actual JNLP connection?

More info below on the actual problem (with fake domains)


  • Master public address : https://jenkins.fakehost.com
  • Master internal address : http://jenkins.fakehost.internal
  • Environment: Docker containers

Command ran:

java -jar slave.jar \
     -jnlpUrl http://jenkins.fakehost.internal/computer/SLAVE_NAME/slave-agent.jnlp \
     -secret SECRET;

Output ....

Sep 04, 2016 5:21:38 PM hudson.remoting.jnlp.Main$CuiListener status
9/5/2016 1:21:38 AMINFO: Locating server among [https://jenkins.fakehost.com/, http://jenkins-internal.fakehost.com/]
9/5/2016 1:21:38 AMSep 04, 2016 5:21:38 PM hudson.remoting.jnlp.Main$CuiListener status
9/5/2016 1:21:38 AMINFO: Handshaking
9/5/2016 1:21:38 AMSep 04, 2016 5:21:38 PM hudson.remoting.jnlp.Main$CuiListener status
9/5/2016 1:21:38 AMINFO: Connecting to jenkins.fakehost.com:50000

Which subsequently led to.

9/5/2016 1:23:56 AM java.net.ConnectException: Connection timed out
9/5/2016 1:23:56 AM at java.net.PlainSocketImpl.socketConnect(Native Method)
9/5/2016 1:23:56 AM at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
9/5/2016 1:23:56 AM at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
9/5/2016 1:23:56 AM at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
9/5/2016 1:23:56 AM at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
9/5/2016 1:23:56 AM at java.net.Socket.connect(Socket.java:589)
9/5/2016 1:23:56 AM at java.net.Socket.connect(Socket.java:538)
9/5/2016 1:23:56 AM at hudson.remoting.Engine.connect(Engine.java:369)
9/5/2016 1:23:56 AM at hudson.remoting.Engine.run(Engine.java:267)

The problem is, despite providing an internal host name, the slave agent, attempts to check for its public host name. And as its https port, but not 50k internal port is valid. Attempts hopelessly to a port it cannot reach.

I been trying to over-ride the command to force it to use the internal hostname, which the slave supports

like image 881
PicoCreator Avatar asked Dec 08 '25 04:12

PicoCreator


1 Answers

In the advanced configuration tab for your JNLP slave, there's an option Tunnel connection through.

Entering jenkins.fakehost.internal: should fix the issue.

like image 185
Alex O Avatar answered Dec 11 '25 02:12

Alex O