最近将jenkins升级到2.263.2版本,升级slave注册失败,看了一下区别是Locating server among少了IP+PORT的连接方式。
升级前
May 07, 2020 12:10:07 PM org.jenkinsci.remoting.engine.WorkDirManager initializeWorkDir
INFO: Using /home/hadoop/.jenkins/remoting as a remoting work directory
Both error and output logs will be printed to /home/hadoop/.jenkins/remoting
May 07, 2020 12:10:08 PM hudson.remoting.jnlp.Main createEngine
INFO: Setting up agent: <slave hostname>
May 07, 2020 12:10:08 PM hudson.remoting.jnlp.Main$CuiListener <init>
INFO: Jenkins agent is running in headless mode.
May 07, 2020 12:10:08 PM hudson.remoting.Engine startEngine
INFO: Using Remoting version: 3.29
May 07, 2020 12:10:08 PM org.jenkinsci.remoting.engine.WorkDirManager initializeWorkDir
INFO: Using /home/hadoop/.jenkins/remoting as a remoting work directory
May 07, 2020 12:10:08 PM hudson.remoting.jnlp.Main$CuiListener status
**INFO: Locating server among [http://ci.xxxxx.com/, http://<jenkins hostname>:8081/]**
May 07, 2020 12:10:08 PM org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver resolve
INFO: Remoting server accepts the following protocols: [JNLP4-connect, Ping]
May 07, 2020 12:10:08 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Agent discovery successful
升级后 locating server 少了hostname:port的地址
INFO: Setting up agent: <slave hostname>
Jan 20, 2021 11:04:52 AM hudson.remoting.jnlp.Main$CuiListener <init>
INFO: Jenkins agent is running in headless mode.
Jan 20, 2021 11:04:52 AM hudson.remoting.Engine startEngine
INFO: Using Remoting version: 3.29
Jan 20, 2021 11:04:52 AM org.jenkinsci.remoting.engine.WorkDirManager initializeWorkDir
INFO: Using /home/hadoop/.jenkins/remoting as a remoting work directory
Jan 20, 2021 11:04:52 AM hudson.remoting.jnlp.Main$CuiListener status
**INFO: Locating server among [http://ci.xxxxx.com/]**
Jan 20, 2021 11:04:52 AM hudson.remoting.jnlp.Main$CuiListener error
SEVERE: http://ci.xxxxx.com/tcpSlaveAgentListener/ is invalid: 403 Forbidden
java.io.IOException: http://ci.xxxxx.com/tcpSlaveAgentListener/ is invalid: 403 Forbidden
at org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver.resolve(JnlpAgentEndpointResolver.java:202)
at hudson.remoting.Engine.innerRun(Engine.java:523)
at hudson.remoting.Engine.run(Engine.java:474)
由于slave节点无法通过ci.xxx.com的认证,只能通过请求hostname:port的方式接入。
是否有配置项,可以增加Locating server among。
我的jenkins run在tomcat上,尝试过添加tomcat启动的环境变量
export JAVA_OPTS="$JAVA_OPTS -Dfile.encoding=UTF-8 -Dhudson.TcpSlaveAgentListener.hostName=hostname:8081"
但是仍然没有解决这个问题。
Set the system property hudson.TcpSlaveAgentListener.hostName
to the hostname or IP address of your Jenkins server on the backend. This will cause all pages to emit an extra HTTP header (X-Jenkins-CLI-Host) containing this specified hostname. This tells CLI clients where to connect, but supposedly not JNLP agents.
有没有碰到同样问题的同学,提供一些新的解决思路。