Skip to content

Commit

Permalink
Merge pull request #21 from aroskuski/master
Browse files Browse the repository at this point in the history
[JENKINS-21276] Fix GroovyPostBuild plugin incorrectly reporting that it failed (improves the behavior used with template-project).
  • Loading branch information
ikedam committed Aug 16, 2015
2 parents 2ee910f + 0e9dfb4 commit e0a3487
Showing 1 changed file with 8 additions and 1 deletion.
Expand Up @@ -345,6 +345,7 @@ public GroovyPostbuildDescriptor getDescriptor() {
@Override
public final boolean perform(final AbstractBuild<?, ?> build, final Launcher launcher, final BuildListener listener) throws InterruptedException, IOException {
Hudson.getInstance().checkPermission(Hudson.ADMINISTER);
boolean scriptResult = true;
LOGGER.fine("perform() called for script");
LOGGER.fine("behavior: " + behavior);
Result scriptFailureResult = Result.SUCCESS;
Expand All @@ -363,11 +364,17 @@ public final boolean perform(final AbstractBuild<?, ?> build, final Launcher lau
// TODO could print more refined errors for UnapprovedUsageException and/or RejectedAccessException:
e.printStackTrace(listener.error("Failed to evaluate groovy script."));
badgeManager.buildScriptFailed(e);
scriptResult = false;
}
for(AbstractBuild<?, ?> b : badgeManager.builds) {
b.save();
}
return build.getResult().isBetterThan(Result.FAILURE);

if (!scriptResult && scriptFailureResult.isWorseOrEqualTo(Result.FAILURE)){
return false;
} else {
return true;
}
}

public final BuildStepMonitor getRequiredMonitorService() {
Expand Down

0 comments on commit e0a3487

Please sign in to comment.