diff --git a/pom.xml b/pom.xml index 42d97dc..6a854f9 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.jenkins-ci.plugins plugin - 1.565 + 1.642.4 com.lookout.jenkins @@ -79,8 +79,13 @@ org.jenkins-ci.plugins matrix-project - 1.4 + 1.6 + + com.github.mjdetullio.jenkins.plugins + multi-branch-project-plugin + 0.5.1 + junit diff --git a/src/main/java/com/lookout/jenkins/EnvironmentScript.java b/src/main/java/com/lookout/jenkins/EnvironmentScript.java index 7d47c19..19ae7e1 100644 --- a/src/main/java/com/lookout/jenkins/EnvironmentScript.java +++ b/src/main/java/com/lookout/jenkins/EnvironmentScript.java @@ -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 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 @@ -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; } } }