Skip to content

Commit

Permalink
Fix for 'Projects triggered by "Parameterized Build Plugin" do not sh…
Browse files Browse the repository at this point in the history
…ow in view with "Downstream-buildview"' (https://issues.jenkins-ci.org/browse/JENKINS-5761)

Applied patch created by samodelkin (https://issues.jenkins-ci.org/secure/ViewProfile.jspa?name=samodelkin) and attached to the JENKINS-5761.
  • Loading branch information
david-resnick committed May 19, 2011
1 parent c0ce12c commit 471be17
Showing 1 changed file with 7 additions and 28 deletions.
Expand Up @@ -29,7 +29,6 @@
import hudson.model.Hudson;
import hudson.model.Result;
import hudson.model.Run;
import hudson.tasks.BuildTrigger;

import java.util.ArrayList;
import java.util.Iterator;
Expand All @@ -47,20 +46,15 @@ public class DownstreamBuildViewAction extends AbstractDownstreamBuildViewAction

public DownstreamBuildViewAction(AbstractBuild<?, ?> build) {
super(build);
BuildTrigger buildTrigger = build.getProject().getPublishersList().get(BuildTrigger.class);
if (buildTrigger != null) {
List<AbstractProject> childs = buildTrigger.getChildProjects();

for (Iterator<AbstractProject> iterator = childs.iterator(); iterator.hasNext();) {
AbstractProject project = iterator.next();
addDownstreamBuilds(project.getName(),0);
}
// downstreamBuildList = findDownstream(childs, 1, new ArrayList<Integer>(),build.getParent().getName(),build.getNumber());
List<AbstractProject> childs = build.getProject().getDownstreamProjects();
for (Iterator<AbstractProject> iterator = childs.iterator(); iterator.hasNext();) {
AbstractProject project = iterator.next();
addDownstreamBuilds(project.getName(),0);
}
// downstreamBuildList = findDownstream(childs, 1, new ArrayList<Integer>(),build.getParent().getName(),build.getNumber());
rootURL = Hudson.getInstance().getRootUrl();
}


private List<DownstreamBuilds> findDownstream(List<AbstractProject> childs, int depth,List<Integer> parentChildSize,String upProjectName,int upBuildNumber) {
List<DownstreamBuilds> childList = new ArrayList<DownstreamBuilds>();
for (Iterator<AbstractProject> iterator = childs.iterator(); iterator.hasNext();) {
Expand Down Expand Up @@ -106,19 +100,15 @@ public class DownstreamBuilds {
private List<Integer> parentChildSize;
private transient AbstractProject project;
private transient Run<?, ?> run;


private void initilize(){
project = Hudson.getInstance().getItemByFullName(projectName, AbstractProject.class);
run = project.getBuildByNumber(buildNumber);
}


public List<Integer> getParentChildSize() {
return parentChildSize;
}



public void setParentChildSize(List<Integer> parentChildSize) {
this.parentChildSize = parentChildSize;
Expand Down Expand Up @@ -154,7 +144,6 @@ public String currentBuildNumber() {
}
return Integer.toString(buildNumber);
}


public int getDepth() {
return depth;
Expand Down Expand Up @@ -195,8 +184,6 @@ public void setDepth(int depth) {
this.depth = depth;
}



public String getStatusMessage() {
if(project == null ){
initilize();
Expand Down Expand Up @@ -231,20 +218,12 @@ public String getRootURL() {
}

public List<DownstreamBuilds> getDownstreamBuildList() {
BuildTrigger buildTrigger = build.getProject().getPublishersList().get(BuildTrigger.class);
if (buildTrigger != null) {
List<AbstractProject> childs = buildTrigger.getChildProjects();
downstreamBuildList = findDownstream(childs, 1, new ArrayList<Integer>(),build.getParent().getName(),build.getNumber());
}
List<AbstractProject> childs = build.getProject().getDownstreamProjects();
downstreamBuildList = findDownstream(childs, 1, new ArrayList<Integer>(),build.getParent().getName(),build.getNumber());
return downstreamBuildList;
}

public void setDownstreamBuildList(List<DownstreamBuilds> downstreamBuildList) {
this.downstreamBuildList = downstreamBuildList;
}





}

0 comments on commit 471be17

Please sign in to comment.