Skip to content

Commit

Permalink
[JENKINS-73467] No facility to try unsupported Remoting versions when…
Browse files Browse the repository at this point in the history
… using inbound agents
  • Loading branch information
basil committed Jul 19, 2024
1 parent 02e37b3 commit a7f1285
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
5 changes: 4 additions & 1 deletion core/src/main/java/jenkins/agents/WebSocketAgents.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
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;
Expand Down Expand Up @@ -107,7 +108,9 @@ public HttpResponse doIndex(StaplerRequest req, StaplerResponse rsp) throws IOEx
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));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>

0 comments on commit a7f1285

Please sign in to comment.