As it turned out in the investigation, "proper" Matrix Project compatibility isn't a quick fix.

~~JENKINS-31128~~ Investigate Matrix Job Compatibility

Below is the result of investigating if SCM extensions could be used to solve our problem.

TL;DR

Writing SCM extensions for Pretested Integration will not solve our Matrix Project related problems. But...

The problems Pretested Integration for Matrix jobs suffers are as follows:

Adding the publisher to the Matrix Job causes the workspace changes in the Matrix Job's workspace to be pushed. However, no merge or verification is ever done there. The Matrix Job only pulls in the SCM changes to test connection before kicking off all its Matrix runs. As a result, the HEAD that was pulled in as a test is pushed ontop of the integration branch, which is not at all what we want.

A second problem is that the merge before verification is done separately by all Matrix runs. This results in N different merges and thus N number of partially tested commits, N being the amount of Matrix runs defined. This doesn't match wanted Pretested Integration behaviour, where we want a single commit to be fully tested.

A possible solution that came to mind was writing SCM extensions for the Prestested Integration plugin, allowing the merge to happen in the Matrix Job as part of the SCM phase. This seemingly solves the first problem, since a merge happens in the Matrix Job. However, this will still result in a poorly tested commit being pushed, since the second problem persists.

The possible solution here is to do the merge before the Matrix Job and having the Matrix Runs pull in and verify that single commit before running the publisher (in this case it would make sense putting the publisher on the Matrix Job).

After another discussion we thought about having the SCM extension push the merge changes back to the ready branch. This might offer a solution.

Code changed in jenkins

User: Mads Nielsen

Path:

pom.xml

src/main/java/org/jenkinsci/plugins/pretestedintegration/PretestedIntegrationBuildWrapper.java

src/main/java/org/jenkinsci/plugins/pretestedintegration/PretestedIntegrationPostCheckout.java

http://jenkins-ci.org/commit/pretested-integration-plugin/80d066a1bbdcf255c1c7ff2f84e99adca7bfef5e

Log:

~~JENKINS-31128~~Added the posibility to run with Matrix projects