Compare commits

...

1 Commits

Author SHA1 Message Date
Kohsuke Kawaguchi 5b854a8850 Added a preliminary support for disabling buildsteps
Still a work to be done on the UI and proper refactoring of the Jelly
tag.
2013-09-05 17:30:55 +02:00
7 changed files with 39 additions and 3 deletions

View File

@ -42,7 +42,7 @@ THE SOFTWARE.
<properties>
<staplerFork>true</staplerFork>
<stapler.version>1.218</stapler.version>
<stapler.version>1.219-SNAPSHOT</stapler.version>
<spring.version>2.5.6.SEC03</spring.version>
<groovy.version>1.8.9</groovy.version>
</properties>

View File

@ -769,6 +769,11 @@ public abstract class AbstractBuild<P extends AbstractProject<P,R>,R extends Abs
* Calls a build step.
*/
protected final boolean perform(BuildStep bs, BuildListener listener) throws InterruptedException, IOException {
if (bs.isDisabled()) {
listener.getLogger().println("Skipping "+bs.getDescriptor().getDisplayName());
return true;
}
BuildStepMonitor mon;
try {
mon = bs.getRequiredMonitorService();

View File

@ -186,4 +186,12 @@ public abstract class JobProperty<J extends Job<?,?>> implements ReconfigurableD
public Collection<? extends SubTask> getSubTasks() {
return Collections.emptyList();
}
/**
* Builder and Publisher can be temporarily disabled but not JobProperty.
*/
@Override
public final boolean isDisabled() {
return false;
}
}

View File

@ -143,6 +143,8 @@ public interface BuildStep {
*/
Collection<? extends Action> getProjectActions(AbstractProject<?,?> project);
Descriptor<? extends BuildStep> getDescriptor();
/**
* Declares the scope of the synchronization monitor this {@link BuildStep} expects from outside.
@ -208,6 +210,8 @@ public interface BuildStep {
*/
BuildStepMonitor getRequiredMonitorService();
boolean isDisabled();
/**
* List of all installed builders.
*

View File

@ -44,7 +44,20 @@ import java.util.Collections;
* @deprecated since 1.150
*/
public abstract class BuildStepCompatibilityLayer implements BuildStep {
//
/**
* Set to true if this build step is disabled.
*/
private boolean disabled;
public boolean isDisabled() {
return disabled;
}
public void setDisabled(boolean disabled) {
this.disabled = disabled;
}
//
// new definitions >= 1.150
//
public boolean prebuild(AbstractBuild<?,?> build, BuildListener listener) {

View File

@ -176,7 +176,7 @@ public class Shell extends CommandInterpreter {
@Override
public Builder newInstance(StaplerRequest req, JSONObject data) {
return new Shell(data.getString("command"));
return req.bindJSON(Shell.class,data);
}
@Override

View File

@ -81,6 +81,12 @@ THE SOFTWARE.
<b>${descriptor.displayName}</b>
</div>
</td>
<td>
<label style="word-wrap:">
<input type="checkbox" name="disabled" checked="${instance.disabled?'true':null}" />
Disabled
</label>
</td>
<j:if test="${help!=null}">
<td>
<a href="#" class="help-button" helpURL="${rootURL}${help}"><img src="${imagesURL}/16x16/help.png" alt="[help]" height="16" width="16"/></a>