Skip to content
Permalink
Browse files
Merge pull request #5 from synopsys-arc-oss/JENKINS-19179
[FIXED JENKINS-19179] - Prevent the disabling of Matrix Configurations
  • Loading branch information
oleg-nenashev committed Oct 14, 2014
2 parents b888102 + dfe5fab commit c5ed324690b68eaa636da879dae801e5f323178f
Showing with 26 additions and 0 deletions.
  1. +25 −0 src/main/java/hudson/matrix/MatrixConfiguration.java
  2. +1 −0 src/main/resources/hudson/matrix/Messages.properties
@@ -49,18 +49,22 @@
import hudson.model.SCMedItem;
import hudson.model.Queue.NonBlockingTask;
import hudson.model.Cause.LegacyCodeCause;
import hudson.model.Failure;
import hudson.scm.SCM;
import jenkins.scm.SCMCheckoutStrategy;
import hudson.tasks.BuildWrapper;
import hudson.tasks.Builder;
import hudson.tasks.LogRotator;
import hudson.tasks.Publisher;
import hudson.util.HttpResponses;

import java.io.IOException;
import java.util.Collections;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.servlet.ServletException;
import org.kohsuke.stapler.HttpResponse;

/**
* One configuration of {@link MatrixProject}.
@@ -105,6 +109,27 @@ public EnvVars getEnvironment(Node node, TaskListener listener) throws IOExcepti
return env;
}

@Override
public final boolean isDisabled() {
// Matrix configurations cannot be disabled independently from the master
return getParent().isDisabled();
}

@Override
public final void makeDisabled(boolean b) throws IOException {
super.makeDisabled(getParent().isDisabled());
}

@Override
public final boolean supportsMakeDisabled() {
return false;
}

@Override
public final HttpResponse doDisable() throws IOException, ServletException {
return HttpResponses.errorWithoutStack(405, Messages.MatrixConfiguration_DisableNotAllowed());
}

@Override
protected void updateTransientActions(){
// This method is exactly the same as in {@link #AbstractProject}.
@@ -32,6 +32,7 @@ MatrixBuild.Interrupting=Interrupting {0}
MatrixBuild.Completed={0} completed with result {1}

MatrixConfiguration.Pronoun=Configuration
MatrixConfiguration.DisableNotAllowed=Matrix configurations cannot be disabled separately. Disable the parent project instead

MatrixRun.KeptBecauseOfParent=Kept because {0} is kept

0 comments on commit c5ed324

Please sign in to comment.