提交 6b6a69ec 编写于 作者: J Jesse Glick

[FIXED JENKINS-19251] Use hashes rather than modification time to determine if...

[FIXED JENKINS-19251] Use hashes rather than modification time to determine if Maven agent JARs are up to date.
上级 7e1fc28c
......@@ -61,6 +61,9 @@ Upcoming changes</a>
<li class='major bug'>
As of 1.532 download of artifact ZIPs was broken.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-19752">issue 19752</a>)
<li class='major bug'>
Old copies of <code>maven3-agent.jar</code> on slaves were not being reliably updated, leading to errors.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-19251">issue 19251</a>)
<li class='rfe'>
Add option to disable "Remember me on this computer" checkbox in login screen.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-15757">issue 15757</a>)
......
......@@ -8,6 +8,7 @@ import hudson.FilePath;
import hudson.Launcher;
import hudson.Platform;
import hudson.Proc;
import hudson.Util;
import hudson.maven.ProcessCache.NewProcess;
import hudson.model.BuildListener;
import hudson.model.Computer;
......@@ -534,7 +535,7 @@ public abstract class AbstractMavenProcessFactory
zip.setProject(new Project());
zip.execute();
jar = t;
} else if (copiedJar.lastModified() > jar.lastModified()) {
} else if (copiedJar.exists() && copiedJar.digest().equals(Util.getDigestOf(jar))) {
log.println(seedName + ".jar already up to date");
return copiedJar;
}
......
......@@ -26,6 +26,7 @@ package hudson.maven;
import hudson.FilePath;
import hudson.Launcher;
import hudson.EnvVars;
import hudson.Util;
import hudson.maven.agent.Main;
import hudson.maven.agent.Maven21Interceptor;
import hudson.model.BuildListener;
......@@ -40,7 +41,6 @@ import java.io.FilenameFilter;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;
/**
......@@ -69,11 +69,10 @@ final class MavenProcessFactory extends AbstractMavenProcessFactory implements P
// TODO why would we not pick it up using GetClassWorldsJar like we do for M2 on master or M3 anywhere?
FilePath jar = slaveRoot.child("classworlds.jar");
// copied to root of this JAR using dependency:generate-resources:
URLConnection conn = MavenProcessFactory.class.getClassLoader().getResource("classworlds.jar").openConnection();
if (jar.lastModified() > conn.getLastModified()) {
if (jar.exists() && jar.digest().equals(Util.getDigestOf(MavenProcessFactory.class.getClassLoader().getResourceAsStream("classworlds.jar")))) {
listener.getLogger().println("classworlds.jar already up to date");
} else {
InputStream in = conn.getInputStream();
InputStream in = MavenProcessFactory.class.getClassLoader().getResourceAsStream("classworlds.jar");
try {
jar.copyFrom(in);
} finally {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册