mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-18 06:22:29 +00:00
Expanded fingerprint relationship to work with ItemGroup/Item hierarchy. This is necessary so that the fingerprint owned by a MavenBuild can be attributed to the parent MavenModuleSetBuild.
Ditto for matrix job. git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@7384 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
1 parent
7bfab380c1
commit
2778d3f0ce
4 files changed
+55
-3
No files matched your search
@@ -1,6 +1,14 @@
|
||||
package hudson.matrix;
|
||||
|
||||
import hudson.model.*;
|
||||
import hudson.model.AbstractBuild;
|
||||
import hudson.model.AbstractProject;
|
||||
import hudson.model.BuildListener;
|
||||
import hudson.model.Executor;
|
||||
import hudson.model.Fingerprint;
|
||||
import hudson.model.Hudson;
|
||||
import hudson.model.JobProperty;
|
||||
import hudson.model.Queue;
|
||||
import hudson.model.Result;
|
||||
import hudson.tasks.Publisher;
|
||||
import org.kohsuke.stapler.StaplerRequest;
|
||||
import org.kohsuke.stapler.StaplerResponse;
|
||||
@@ -49,6 +57,16 @@ public class MatrixBuild extends AbstractBuild<MatrixProject,MatrixBuild> {
|
||||
return config.getBuildByNumber(getNumber());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all {@link MatrixRun}s for this {@link MatrixBuild}.
|
||||
*/
|
||||
public List<MatrixRun> getRuns() {
|
||||
List<MatrixRun> r = new ArrayList<MatrixRun>();
|
||||
for(MatrixConfiguration c : getParent().getItems())
|
||||
r.add(c.getBuildByNumber(getNumber()));
|
||||
return r;
|
||||
}
|
||||
|
||||
public Object getDynamic(String token, StaplerRequest req, StaplerResponse rsp) {
|
||||
try {
|
||||
MatrixRun item = getRun(Combination.fromString(token));
|
||||
@@ -65,6 +83,14 @@ public class MatrixBuild extends AbstractBuild<MatrixProject,MatrixBuild> {
|
||||
run(new RunnerImpl());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Fingerprint.RangeSet getDownstreamRelationship(AbstractProject that) {
|
||||
Fingerprint.RangeSet rs = super.getDownstreamRelationship(that);
|
||||
for(MatrixRun run : getRuns())
|
||||
rs.add(run.getDownstreamRelationship(that));
|
||||
return rs;
|
||||
}
|
||||
|
||||
private class RunnerImpl extends AbstractRunner {
|
||||
private final List<MatrixAggregator> aggregators = new ArrayList<MatrixAggregator>();
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import hudson.model.AbstractProject;
|
||||
import hudson.model.Action;
|
||||
import hudson.model.Build;
|
||||
import hudson.model.BuildListener;
|
||||
import hudson.model.Fingerprint;
|
||||
import hudson.model.Hudson;
|
||||
import hudson.model.Result;
|
||||
import hudson.remoting.Channel;
|
||||
@@ -175,6 +176,15 @@ public final class MavenModuleSetBuild extends AbstractBuild<MavenModuleSet,Mave
|
||||
getProject().updateTransientActions();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Fingerprint.RangeSet getDownstreamRelationship(AbstractProject that) {
|
||||
Fingerprint.RangeSet rs = super.getDownstreamRelationship(that);
|
||||
for(List<MavenBuild> builds : getModuleBuilds().values())
|
||||
for (MavenBuild b : builds)
|
||||
rs.add(b.getDownstreamRelationship(that));
|
||||
return rs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a module build that corresponds to this module set build
|
||||
* has completed.
|
||||
|
||||
@@ -30,7 +30,17 @@ import javax.servlet.ServletException;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintStream;
|
||||
import java.util.*;
|
||||
import java.util.AbstractSet;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Base implementation of {@link Run}s that build software.
|
||||
@@ -460,7 +470,7 @@ public abstract class AbstractBuild<P extends AbstractProject<P,R>,R extends Abs
|
||||
// look for fingerprints that point to the given project as the source, and merge them all
|
||||
for (Fingerprint e : f.getFingerprints().values()) {
|
||||
BuildPtr o = e.getOriginal();
|
||||
if(o!=null && o.is(that))
|
||||
if(o!=null && o.belongsTo(that))
|
||||
n = Math.max(n,o.getNumber());
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@ import com.thoughtworks.xstream.io.HierarchicalStreamReader;
|
||||
import com.thoughtworks.xstream.io.HierarchicalStreamWriter;
|
||||
import hudson.Util;
|
||||
import hudson.XmlFile;
|
||||
import hudson.maven.MavenModule;
|
||||
import hudson.maven.MavenModuleSet;
|
||||
import hudson.util.HexBinaryConverter;
|
||||
import hudson.util.Iterators;
|
||||
import hudson.util.XStream2;
|
||||
@@ -113,6 +115,10 @@ public class Fingerprint implements ModelObject {
|
||||
/**
|
||||
* Returns true if {@link BuildPtr} points to the given job
|
||||
* or one of its subordinates.
|
||||
*
|
||||
* <p>
|
||||
* This is useful to check if an artifact in {@link MavenModule}
|
||||
* belongs to {@link MavenModuleSet}.
|
||||
*/
|
||||
public boolean belongsTo(Job job) {
|
||||
Item p = Hudson.getInstance().getItemByFullName(name);
|
||||
|
||||
Reference in new issue
Block a user