Skip to content

Commit

Permalink
Merge pull request #5 from synopsys-arc-oss/JENKINS-19179
Browse files Browse the repository at this point in the history
[FIXED JENKINS-19179] - Prevent the disabling of Matrix Configurations
  • Loading branch information
oleg-nenashev committed Oct 14, 2014
2 parents b888102 + dfe5fab commit c5ed324
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/main/java/hudson/matrix/MatrixConfiguration.java
Expand Up @@ -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}.
Expand Down Expand Up @@ -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}.
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/hudson/matrix/Messages.properties
Expand Up @@ -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

Expand Down

0 comments on commit c5ed324

Please sign in to comment.