Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
Merge pull request #18 from mmenev/JENKINS-17663
[FIXED JENKINS-17663] Added global fail on error checkbox.
  • Loading branch information
uhafner committed Jul 2, 2013
2 parents 7a18edf + 40ec0a8 commit 309403780b6425e3f2a1ca2907e82d082a991a46
@@ -34,8 +34,12 @@ public Descriptor<GlobalSettings> getDescriptor() {
*/
@Extension
public static class DescriptorImpl extends Descriptor<GlobalSettings> {

private Boolean isQuiet;

private Boolean failOnCorrupt;


@Override
public String getDisplayName() {
return StringUtils.EMPTY;
@@ -59,16 +63,34 @@ public boolean configure(final StaplerRequest req, final JSONObject json) throws
}

/**
* Returns the value of the example boolean property.
* Returns the value of the quiet boolean property.
*
* @return the status of the example boolean property
* @return the status of the quiet boolean property
*/
public Boolean getQuiet() {
return isQuiet;
}

/**
* Sets the value of the example boolean property.
* Returns the value of the failOnCorrupt boolean property.
*
* @return the status of the failOnCorrupt boolean property
*/
public Boolean getFailOnCorrupt() {
return failOnCorrupt == null ? Boolean.FALSE : failOnCorrupt;
}

/**
* Sets the value of the failOnCorrupt boolean property.
*
* @param value the value to set
*/
public void setFailOnCorrupt(final Boolean value) {
failOnCorrupt = value;
}

/**
* Sets the value of the quiet boolean property.
*
* @param value the value to set
*/
@@ -2,6 +2,7 @@

import java.io.IOException;

import jenkins.model.Jenkins;
import hudson.Launcher;

import hudson.model.Result;
@@ -120,31 +121,36 @@ public HealthAwarePublisher(final String healthy, final String unHealthy,
}

/**
* Callback method that is invoked after the build where this recorder can
* collect the results. This default implementation provides a template
* method that updates the build status based on the results and copies all
* files with warnings to the build folder on the master.
* Callback method that is invoked after the build where this recorder can collect the results. This default
* implementation provides a template method that updates the build status based on the results and copies all files
* with warnings to the build folder on the master.
*
* @param build
* current build
* @param launcher
* the launcher for this build
* @param logger
* the logger
* @return <code>true</code> if the build can continue, <code>false</code>
* otherwise
* @return <code>true</code> if the build can continue, <code>false</code> otherwise
* @throws IOException
* in case of problems during file copying
* @throws InterruptedException
* if the user canceled the build
*/
@Override
protected boolean perform(final AbstractBuild<?, ?> build, final Launcher launcher,
final PluginLogger logger) throws IOException, InterruptedException {
protected boolean perform(final AbstractBuild<?, ?> build, final Launcher launcher, final PluginLogger logger)
throws IOException, InterruptedException {
BuildResult result;
try {
result = perform(build, logger);
AbstractBuild<?, ?> referenceBuild = result.getHistory().getReferenceBuild();
GlobalSettings.DescriptorImpl descriptor = (GlobalSettings.DescriptorImpl)Jenkins.getInstance()
.getDescriptorOrDie(GlobalSettings.class);

if (descriptor.getFailOnCorrupt() && !result.getErrors().isEmpty()) {
return false;
}

if (referenceBuild != null) {
logger.log("Computing warning deltas based on reference build " + referenceBuild.getDisplayName());
}
@@ -159,8 +165,7 @@ protected boolean perform(final AbstractBuild<?, ?> build, final Launcher launch
updateBuildResult(result, logger);
}

copyFilesWithAnnotationsToBuildFolder(build.getRootDir(), launcher.getChannel(),
result.getAnnotations());
copyFilesWithAnnotationsToBuildFolder(build.getRootDir(), launcher.getChannel(), result.getAnnotations());

return true;
}
@@ -1,8 +1,13 @@
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">

<f:section title="${%jelly.section.title.AnalysisCoreGroup}">
<f:entry field="quiet" title="${%jelly.entry.title.quietMode}">
<f:checkbox/>
</f:entry>

<f:entry field="failOnCorrupt" title="${%Fail on corrupted config}" description="${%description.failOnCorrupt}">
<f:checkbox />
</f:entry>
</f:section>
</j:jelly>
@@ -1,2 +1,3 @@
jelly.section.title.AnalysisCoreGroup=Analysis Core Group
jelly.entry.title.quietMode=Logger Quiet Mode:
jelly.entry.title.quietMode=Logger Quiet Mode:
description.failOnCorrupt=If checked a fail by publishing report will fail the whole build.

0 comments on commit 3094037

Please sign in to comment.