[JENKINS-73467] No facility to try unsupported Remoting versions when using inbound agents (#9485)

This commit is contained in:
Basil Crow authored and GitHub committed 2024-07-20 16:44:58 -06:00
1 parent 7680da0cef
commit e4f3a0d2fe
2 files changed
+9 -3

No files matched your search

@@ -36,6 +36,7 @@ import hudson.remoting.Capability;
import hudson.remoting.ChannelBuilder;
import hudson.remoting.ChunkHeader;
import hudson.remoting.Engine;
import hudson.slaves.SlaveComputer;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.ClosedChannelException;
@@ -107,7 +108,9 @@ public final class WebSocketAgents extends InvisibleAction implements Unprotecte
Capability remoteCapability = Capability.fromASCII(remoteCapabilityStr);
LOGGER.fine(() -> "received " + remoteCapability);
rsp.setHeader(Capability.KEY, new Capability().toASCII());
rsp.setHeader(Engine.REMOTING_MINIMUM_VERSION_HEADER, RemotingVersionInfo.getMinimumSupportedVersion().toString());
if (!SlaveComputer.ALLOW_UNSUPPORTED_REMOTING_VERSIONS) {
rsp.setHeader(Engine.REMOTING_MINIMUM_VERSION_HEADER, RemotingVersionInfo.getMinimumSupportedVersion().toString());
}
rsp.setHeader(Engine.WEBSOCKET_COOKIE_HEADER, cookie);
return WebSockets.upgrade(new Session(state, agent, remoteCapability));
}
@@ -40,8 +40,11 @@ THE SOFTWARE.
<!-- reduce the number of client connection attempts during protocol negotiation -->
<st:header name="X-Jenkins-Agent-Protocols" value="${app.tcpSlaveAgentListener.agentProtocolNames}"/>
<!-- publish minimum supported version of remoting agent -->
<j:getStatic var="rmvh" className="hudson.remoting.Engine" field="REMOTING_MINIMUM_VERSION_HEADER"/>
<st:header name="${rmvh}" value="${app.tcpSlaveAgentListener.remotingMinimumVersion}"/>
<j:getStatic var="allowUnsupportedRemotingVersions" className="hudson.slaves.SlaveComputer" field="ALLOW_UNSUPPORTED_REMOTING_VERSIONS"/>
<j:if test="${!allowUnsupportedRemotingVersions}">
<j:getStatic var="rmvh" className="hudson.remoting.Engine" field="REMOTING_MINIMUM_VERSION_HEADER"/>
<st:header name="${rmvh}" value="${app.tcpSlaveAgentListener.remotingMinimumVersion}"/>
</j:if>
Jenkins
</j:jelly>