Skip to content

Commit

Permalink
fix for JENKINS-5411 to send "still unstable" email instead of unstable
Browse files Browse the repository at this point in the history
for cases when the previous build is failed or aborted we should
send a still unstable email instead of simply stable
to fix this issue made change to iterate through all the previous builds
and find out whether all the prev builds are "fail" or "abort" or not.
  • Loading branch information
farshidce committed Mar 25, 2011
1 parent 8b09bde commit 22f6e16
Showing 1 changed file with 23 additions and 2 deletions.
Expand Up @@ -46,8 +46,29 @@ public <P extends AbstractProject<P, B>, B extends AbstractBuild<P, B>> String g
}
} else if (buildResult == Result.UNSTABLE) {
B prevBuild = build.getPreviousBuild();
if (prevBuild != null && (prevBuild.getResult() == Result.UNSTABLE)) {
return "Still Unstable";
if (prevBuild != null) {
if (prevBuild.getResult() == Result.UNSTABLE) {
return "Still Unstable";
} else if (prevBuild.getResult() == Result.SUCCESS) {
return "Unstable";
} else if (prevBuild.getResult() == Result.FAILURE ||
prevBuild.getResult() == Result.ABORTED ||
prevBuild.getResult() == Result.NOT_BUILT) {
//iterate through previous builds
//(fail_or_aborted)*--> unstable : return still unstable
//(fail_or_aborted)*--> unstable : return unstable
B previous = prevBuild.getPreviousBuild();
while (previous != null) {
if (previous.getResult() == Result.SUCCESS) {
return "Unstable";
}
if (previous.getResult() == Result.UNSTABLE) {
return "Still unstable";
}
previous = previous.getPreviousBuild();
}
return "Unstable";
}
} else {
return "Unstable";
}
Expand Down

0 comments on commit 22f6e16

Please sign in to comment.