Skip to content
Permalink
Browse files
[FIXED JENKINS-19251] Use hashes rather than modification time to det…
…ermine if Maven agent JARs are up to date.
  • Loading branch information
jglick committed Sep 29, 2013
1 parent 7e1fc28 commit 6b6a69ec0d63986d82616794d5a7fcf93df14b0e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
@@ -61,6 +61,9 @@
<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.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 @@ static FilePath copyJar(PrintStream log, FilePath dst, Class<?> representative,
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 @@
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.IOException;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;


/**
@@ -69,11 +69,10 @@ protected String getMavenAgentClassPath(MavenInstallation mvn, FilePath slaveRoo
// 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 {

0 comments on commit 6b6a69e

Please sign in to comment.