Skip to content

Commit

Permalink
[FIXED JENKINS-15601] Use Job.getLastUnstableBuild, which is safe for…
Browse files Browse the repository at this point in the history
… 1.485+.

Also in getLastAbortedBuild, limit the number of builds searched.
  • Loading branch information
jglick committed Nov 8, 2013
1 parent 4b3f3b0 commit 40af81d
Showing 1 changed file with 3 additions and 10 deletions.
Expand Up @@ -177,15 +177,7 @@ public static BuildInfo getLastStableBuild(Job<?, ?> job, Locale locale, boolean

public static BuildInfo getLastUnstableBuild(Job<?, ?> job, Locale locale, boolean isUnstableShownOnlyIfLast,
boolean isShowColorblindUnderlineHint, boolean isFirst, TimeAgoType timeAgoType) {
Run<?, ?> lastUnstable = null;
Run<?, ?> latest = job.getLastBuild();
while (latest != null) {
if (latest.getResult() == Result.UNSTABLE) {
lastUnstable = latest;
break;
}
latest = latest.getPreviousBuild();
}
Run<?, ?> lastUnstable = job.getLastUnstableBuild();
if (lastUnstable == null) {
return null;
}
Expand All @@ -207,7 +199,8 @@ private static void addNonNull(List<BuildInfo> builds, BuildInfo info) {
}
private static Run<?, ?> getLastAbortedBuild(Job<?, ?> job) {
Run<?, ?> latest = job.getLastBuild();
while (latest != null) {
int i = 0;
while (latest != null && i++ < 20) {
if (latest.getResult() == Result.ABORTED) {
return latest;
}
Expand Down

0 comments on commit 40af81d

Please sign in to comment.