提交 ac93fbe8 编写于 作者: K kohsuke

[fixed] display what's blocking the matrix configuration build in 1.202. (issue #1455)


git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@8115 71c3de6d-444a-0410-be80-ed276b4c234a
上级 eb2f11e3
......@@ -39,10 +39,21 @@ public class MatrixBuild extends AbstractBuild<MatrixProject,MatrixBuild> {
super(project, buildDir);
}
/**
* Used by view to render a ball for {@link MatrixRun}.
*/
public final class RunPtr {
public final Combination combination;
private RunPtr(Combination c) { this.combination=c; }
public MatrixRun getRun() { return MatrixBuild.this.getRun(combination); }
public String getTooltip() {
MatrixRun r = getRun();
if(r!=null) return r.getIconColor().getDescription();
Queue.Item item = Hudson.getInstance().getQueue().getItem(getParent().getItem(combination));
if(item!=null)
return item.getWhy();
return null; // fall back
}
}
public Layouter<RunPtr> getLayouter() {
......@@ -133,7 +144,7 @@ public class MatrixBuild extends AbstractBuild<MatrixProject,MatrixBuild> {
try {
for(MatrixConfiguration c : activeConfigurations) {
logger.println(Messages.MatrixBuild_Triggering(c.getName()));
logger.println(Messages.MatrixBuild_Triggering(c.getDisplayName()));
c.scheduleBuild();
}
......@@ -142,6 +153,9 @@ public class MatrixBuild extends AbstractBuild<MatrixProject,MatrixBuild> {
Result r = Result.SUCCESS;
for (MatrixConfiguration c : activeConfigurations) {
String whyInQueue = "";
long startTime = System.currentTimeMillis();
// wait for the completion
while(true) {
MatrixRun b = c.getBuildByNumber(n);
......@@ -151,8 +165,9 @@ public class MatrixBuild extends AbstractBuild<MatrixProject,MatrixBuild> {
Result buildResult = null;
if(b!=null && !b.isBuilding())
buildResult = b.getResult();
if(b==null && !c.isInQueue()) {
// there's conceivably a race condition here, sine b is set early on,
Queue.Item qi = c.getQueueItem();
if(b==null && qi==null) {
// there's conceivably a race condition here, since b is set early on,
// and we are checking c.isInQueue() later. A build might have started
// after we computed b but before we checked c.isInQueue(). So
// double-check 'b' to see if it's really not there. Possibly related to
......@@ -171,12 +186,24 @@ public class MatrixBuild extends AbstractBuild<MatrixProject,MatrixBuild> {
if(!a.endRun(b))
return Result.FAILURE;
break;
} else {
if(qi!=null) {
// if the build seems to be stuck in the queue, display why
String why = qi.getWhy();
if(!why.equals(whyInQueue) && System.currentTimeMillis()-startTime>5000) {
logger.println(c.getDisplayName()+" is still in the queue: "+why);
whyInQueue = why;
}
}
}
Thread.sleep(1000);
}
}
return r;
} catch( InterruptedException e ) {
logger.println("Aborted");
return Result.ABORTED;
} finally {
// if the build was aborted in the middle. Cancel all the configuration builds.
Queue q = Hudson.getInstance().getQueue();
......
......@@ -5,7 +5,7 @@
<l:ajax>
<p:matrix autoRefresh="${it.isBuilding()}">
<j:set var="b" value="${p.run}" />
<a href="${p.combination}">
<a href="${p.combination}" tooltip="${p.tooltip}">
<img src="${imagesURL}/24x24/${h.ifThenElse(b!=null,b.buildStatusUrl,'grey.gif')}"
title="${b.iconColor.description}"/>
<j:if test="${empty(o.x) and empty(o.y)}">
......
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:i="jelly:fmt" xmlns:p="/lib/hudson/project">
<st:include page="ajaxMatrix.jelly" />
</j:jelly>
\ No newline at end of file
</j:jelly
>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册