Skip to content
Permalink
Browse files

[JENKINS-31128] Added the posibility to run with Matrix projects

  • Loading branch information...
MadsNielsen authored and praqma-thi committed Oct 23, 2015
1 parent 146fefe commit 80d066a1bbdcf255c1c7ff2f84e99adca7bfef5e
12 pom.xml
@@ -3,7 +3,7 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>1.580</version>
<version>1.580</version> <!-- Do not forget to update the test harness dependency! -->
</parent>

<url>http://wiki.jenkins-ci.org/display/JENKINS/Pretested+Integration+Plugin</url>
@@ -471,14 +471,14 @@
<version>1.37</version>
<optional>true</optional>
</dependency>

<!--
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>matrix-project</artifactId>
<version>1.4</version>
<scope>test</scope>
<version>1.3</version>
<optional>true</optional>
</dependency>

-->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
@@ -495,7 +495,7 @@
<dependency>
<groupId>org.jenkins-ci.main</groupId>
<artifactId>jenkins-test-harness</artifactId>
<version>1.532</version>
<version>1.580</version>
<scope>test</scope>
</dependency>
<dependency>
@@ -29,6 +29,8 @@
public static final String LOG_PREFIX = "[PREINT] ";
public final AbstractSCMBridge scmBridge;



@DataBoundConstructor
public PretestedIntegrationBuildWrapper(final AbstractSCMBridge scmBridge) {
this.scmBridge = scmBridge;
@@ -3,6 +3,8 @@
import hudson.AbortException;
import hudson.Extension;
import hudson.Launcher;
import hudson.matrix.MatrixConfiguration;
import hudson.matrix.MatrixProject;
import hudson.model.AbstractBuild;
import hudson.model.AbstractProject;
import hudson.model.BuildListener;
@@ -27,13 +29,20 @@
public PretestedIntegrationPostCheckout() {
}

private AbstractSCMBridge getScmBridge(AbstractBuild<?, ?> build) throws AbortException {
if (build.getProject() instanceof FreeStyleProject) {
private AbstractSCMBridge getScmBridge(AbstractBuild<?, ?> build) throws AbortException {
AbstractProject<?,?> proj = build.getProject();


if (proj instanceof FreeStyleProject) {
FreeStyleProject p = (FreeStyleProject) build.getProject();
PretestedIntegrationBuildWrapper wrapper = p.getBuildWrappersList().get(PretestedIntegrationBuildWrapper.class);
return wrapper.scmBridge;
} else if(proj instanceof MatrixConfiguration) {
MatrixProject p = ((MatrixConfiguration)proj).getParent();
PretestedIntegrationBuildWrapper wrapper = p.getBuildWrappersList().get(PretestedIntegrationBuildWrapper.class);
return wrapper.scmBridge;
} else {
throw new AbortException("Not supported for non-FreeStyle projects");
throw new AbortException("Unsupported job type.");
}
}

0 comments on commit 80d066a

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