Skip to content
Permalink
Browse files
[FIXED JENKINS-9687] log build steps which have changed the build res…
…ult to console
  • Loading branch information
kutzi committed May 22, 2011
1 parent 0b01182 commit a3d138867785a153aca10cfb056e786369678f88
Showing with 23 additions and 1 deletion.
  1. +3 −0 changelog.html
  2. +20 −1 core/src/main/java/hudson/model/AbstractBuild.java
@@ -77,6 +77,9 @@
(<a href="http://issues.jenkins-ci.org/browse/JENKINS-9671">issue 9671</a>)
<li class=rfe>
Add a default attribute to repeatableProperty and repeatable jelly tags
<li class=rfe>
Log which build steps have changed the build result to build console.
(<a href="http://issues.jenkins-ci.org/browse/JENKINS-9687">issue 9687</a>)
</ul>
</div><!--=TRUNK-END=-->

@@ -659,7 +659,26 @@ protected final boolean perform(BuildStep bs, BuildListener listener) throws Int
} catch (AbstractMethodError e) {
mon = BuildStepMonitor.BUILD;
}
return mon.perform(bs, AbstractBuild.this, launcher, listener);
Result oldResult = AbstractBuild.this.getResult();
boolean canContinue = mon.perform(bs, AbstractBuild.this, launcher, listener);
Result newResult = AbstractBuild.this.getResult();
if (newResult != oldResult) {
String buildStepName = getBuildStepName(bs);
listener.getLogger().format("Build step '%s' changed build result to %s%n", buildStepName, newResult);
}
if (!canContinue) {
String buildStepName = getBuildStepName(bs);
listener.getLogger().format("Build step '%s' marked build as failure%n", buildStepName);
}
return canContinue;
}

private String getBuildStepName(BuildStep bs) {
if (bs instanceof Describable<?>) {
return ((Describable<?>) bs).getDescriptor().getDisplayName();
} else {
return bs.getClass().getSimpleName();
}
}

protected final boolean preBuild(BuildListener listener,Map<?,? extends BuildStep> steps) {

0 comments on commit a3d1388

Please sign in to comment.