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.

Originally-Committed-As: 6b6a69ec0d63986d82616794d5a7fcf93df14b0e
  • Loading branch information
jglick committed Sep 29, 2013
1 parent 509e9ad commit 92e23770a12e0815e81d72aa63ead9c04c1a8cc2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
@@ -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 92e2377

Please sign in to comment.