title: Building jenkins job only once, when tracking multiple branches?
body: <p>In one jenkins job, we want to track multiple branches and trigger it only once when there are changes in any of them. Is that possible? </p>
  
  <p>The problem is, that we have to run a bunch of jobs for each branch serially and they should not interfer. What we want to achieve is for example:</p>
  
  <pre><code>[changes on any branch] -&gt; checkout master -&gt; job1 -&gt; job2 -&gt; job3 -&gt; checkout release -&gt; job1 -&gt; job2 -&gt; job3
  </code></pre>
  
  <p>The current behaviour is, that the job gets triggered for each branch that has changes. So, if the 'build pipeline' has been triggered because of changes in master, it's possible to be triggered again caused by changes in release:</p>
  
  <pre><code>[changes on master]  -&gt; checkout master -&gt; job1 -&gt; ... -&gt; checkout release -&gt; ...
  [changes on release] -&gt; checkout master -&gt; job1 -&gt; ... -&gt; checkout release -&gt; ...
  </code></pre>
  
  <p>Another (even better) option would be, to start one job periodically and do the build stuff for each branch only, if it has changes:</p>
  
  <pre><code>for each branch do
    if branch has changes then
      job1
      job2
      ...
  </code></pre>