Skip to content

Commit

Permalink
JENKINS-36697 Must show "Run Only on Parent" for
Browse files Browse the repository at this point in the history
MatrixMultibranchProject
  • Loading branch information
otlabs-ci committed Jul 30, 2016
1 parent 3dae55b commit 8095c85
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
9 changes: 7 additions & 2 deletions pom.xml
Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down
10 changes: 8 additions & 2 deletions src/main/java/com/lookout/jenkins/EnvironmentScript.java
Expand Up @@ -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;
Expand Down Expand Up @@ -228,7 +230,7 @@ public String[] buildCommandLine(FilePath scriptFile) {
}

/**
* 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
Expand Down Expand Up @@ -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.