Skip to content
Permalink
Browse files

[JENKINS-48766] - Print warnings in agent connection logs when the Re…

…moting version is not supported
  • Loading branch information...
oleg-nenashev committed Jan 22, 2018
1 parent 1b2f0e7 commit 95f1f5ad19385408da15eb1b4dcaedb705dee638
Showing with 8 additions and 0 deletions.
  1. +8 −0 core/src/main/java/hudson/slaves/SlaveComputer.java
@@ -47,13 +47,15 @@
import hudson.util.NullStream;
import hudson.util.RingBufferLogHandler;
import hudson.util.StreamTaskListener;
import hudson.util.VersionNumber;
import hudson.util.io.RewindableFileOutputStream;
import hudson.util.io.RewindableRotatingFileOutputStream;
import jenkins.model.Jenkins;
import jenkins.security.ChannelConfigurator;
import jenkins.security.MasterToSlaveCallable;
import jenkins.slaves.EncryptedSlaveAgentJnlpFile;
import jenkins.slaves.JnlpSlaveAgentProtocol;
import jenkins.slaves.RemotingVersionInfo;
import jenkins.slaves.systemInfo.SlaveSystemInfo;
import jenkins.util.SystemProperties;
import org.acegisecurity.context.SecurityContext;
@@ -545,6 +547,12 @@ public void onClosed(Channel c, IOException cause) {

String slaveVersion = channel.call(new SlaveVersion());
log.println("Remoting version: " + slaveVersion);
VersionNumber agentVersion = new VersionNumber(slaveVersion);
if (agentVersion.isOlderThan(RemotingVersionInfo.getMinimumSupportedVersion())) {
log.println(String.format("WARNING: Remoting version is older than a minimum required one (%s). " +
"Connection will not be rejected, but the compatibility is NOT guaranteed",
RemotingVersionInfo.getMinimumSupportedVersion()));
}

boolean _isUnix = channel.call(new DetectOS());
log.println(_isUnix? hudson.model.Messages.Slave_UnixSlave():hudson.model.Messages.Slave_WindowsSlave());

0 comments on commit 95f1f5a

Please sign in to comment.
You can’t perform that action at this time.