Jenkins: Trigger Multi-branch pipeline on upstream change
<p>I am currently testing the pipeline approach of Jenkins 2.0 to see if it works for the build environment I am using.</p>

<p>First about the environment itself. It currently consists of multiple SCM repositories. Each repository contains multiple branches, for the different stages of the development and each branch is build with multiple configurations. Not all configurations apply to every repository.</p>

<p>Currently every repository/branch is setup as a <a href="https://wiki.jenkins-ci.org/display/JENKINS/Matrix+Project+Plugin" rel="noreferrer" title="Matrix Project Plugin">Matrix Project</a> for the different configurations. Each project exposes it's building results as a artifact and these artifacts are used in the downstream projects.</p>

<p>The different repositories depend on each other, so a successful build on a upstream job triggers some specific down stream jobs. Currently all that works, but the amount of work required to setup a new branch or to tweak the building process is a lot, since many different projects need to be altered by hand.</p>

<p>Now I wanted to give the new pipelines a try. My idea was to create multi-branch pipeline projects and place a <code>Jenkinsfile</code> inside the repository containing the instructions for the build.</p>

<p>The main problem is getting the builds to trigger each other, because basically a build in a specific upstream branch, needs to trigger a downstream branch. How ever the information what downstream branches need to be triggered is not known to the upstream project. Each downstream project fetches the artifacts from some upstream branches and the ideal solution would be if the downstream build would be triggered in case the upstream build that is the source for the artifact finishes it's build.</p>

<p>The problem is only the downstream projects really know what artifacts they require. The branch names are unlikely to match in most cases and that makes triggering the builds from the upstream project very difficult.</p>

<p>Currently this is solved using the <a href="http://javadoc.jenkins-ci.org/jenkins/triggers/ReverseBuildTrigger.html" rel="noreferrer" title="ReverseBuildTrigger JavaDoc"><code>ReverseBuildTrigger</code></a>. But this thing stops working as soon as it gets anywhere close to a pipeline.</p>

<p>I am really at a loss how to get this working. Is there any way to get something like the <a href="http://javadoc.jenkins-ci.org/jenkins/triggers/ReverseBuildTrigger.html" rel="noreferrer" title="ReverseBuildTrigger JavaDoc"><code>ReverseBuildTrigger</code></a> working inside pipeline scripts?</p>

<p>Also triggering the entire downstream build for all branches in case a single branch upstream is changed is not a option. This would create far too many equal builds.</p>