Skip to content
Permalink
Browse files

JENKINS-36697 Must show "Run Only on Parent" for

MatrixMultibranchProject
  • Loading branch information...
otlabs-ci committed Jul 30, 2016
1 parent 3dae55b commit 8095c85a816daee05aad5a332a0e0821c1963e88
Showing with 15 additions and 4 deletions.
  1. +7 −2 pom.xml
  2. +8 −2 src/main/java/com/lookout/jenkins/EnvironmentScript.java
@@ -6,7 +6,7 @@
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<!-- Which version of Jenkins is this plugin built against? -->
<version>1.565</version>
<version>1.642.4</version>
</parent>

<groupId>com.lookout.jenkins</groupId>
@@ -79,8 +79,13 @@
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>matrix-project</artifactId>
<version>1.4</version>
<version>1.6</version>
</dependency>
<dependency>
<groupId>com.github.mjdetullio.jenkins.plugins</groupId>
<artifactId>multi-branch-project-plugin</artifactId>
<version>0.5.1</version>
</dependency>
<!-- Test Dependencies -->
<dependency>
<groupId>junit</groupId>
@@ -35,6 +35,8 @@
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.StaplerRequest;

import com.github.mjdetullio.jenkins.plugins.multibranch.MatrixMultiBranchProject;

import com.lookout.jenkins.commands.Commands;
import com.lookout.jenkins.commands.PowerShell;
import com.lookout.jenkins.commands.Shebangs;
@@ -228,7 +230,7 @@ public void buildEnvVars(Map<String, String> env) {
}

/**
* Create an aggregator that will calculate the environment once iff onlyRunOnParent is true.
* Create an aggregator that will calculate the environment once if onlyRunOnParent is true.
*
* The aggregator we return is called on the parent job for matrix jobs. In it we generate the environment once and
* persist it in an Action (of type {@link PersistedEnvironment}) if the job has onlyRunOnParent enabled. The
@@ -287,7 +289,11 @@ public boolean isApplicable(AbstractProject<?, ?> project) {
}

public boolean isMatrix(StaplerRequest request) {
return (request.findAncestorObject(AbstractProject.class) instanceof MatrixProject);
if (request.findAncestorObject(MatrixMultiBranchProject.class) != null ||
request.findAncestorObject(MatrixProject.class) != null) {
return Boolean.TRUE;
}
return Boolean.FALSE;
}
}
}

0 comments on commit 8095c85

Please sign in to comment.
You can’t perform that action at this time.