Skip to content
Permalink
Browse files

fix for JENKINS-5411 to send "still unstable" email instead of unstable

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 22f6e1655b33049c686a98988cac32947de0d27f
Showing with 23 additions and 2 deletions.
  1. +23 −2 src/main/java/hudson/plugins/emailext/plugins/content/BuildStatusContent.java
@@ -46,8 +46,29 @@ public String getHelpText() {
}
} 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";
}

0 comments on commit 22f6e16

Please sign in to comment.
You can’t perform that action at this time.