title: Pipeline to use artifacts from 2 projects associated by the same git branch name
body: <p>the company where I work for is evaluating jenkins 2.71, in particular the <strong>pipeline</strong> and <strong>blue ocean</strong> plugins. We already tested also <a href="https://docs.gocd.org/current/" rel="nofollow noreferrer">GoCD</a> and we need, as in <strong>GoCD</strong>, a way for a pipeline to automatically fetch the artifacts from 2 other pipelines (taking the last successful result of each one of them), here our case.</p>
  
  <p>We have these initial pipelines (build &amp; run tests), which reflect 2 projects:</p>
  
  <ul>
  <li><strong>frontend</strong>, ~ 15 minutes</li>
  <li><strong>backend</strong>, ~10 minutes</li>
  </ul>
  
  <p>I created a pipeline called <strong>configure</strong> (~1 minute), with e.g. a parameter called <em>customer-name</em>, which takes backend and frontend files and puts them together, then applies specific customer specific configurations and customizations and produces deployable artifacts. Instead of "customer-name" I could also parallelize this job to create all the artifacts for each customer at once, separated in different directories.</p>
  
  <p>The next pipeline would be to deploy them on different test servers separated for each customer. This could be also part of the same <strong>configure</strong> pipeline, we still have to see how to put things together in jenkins...</p>
  
  <p>Ideally, I need <strong>configure</strong> pipeline to be <strong>triggered automatically (or also on demand) after each frontend or backend success</strong> and take as input the last successful artifacts from these 2 pipelines, but not just having the last successful build, we need as <strong>dependency the git branch name</strong>.</p>
  
  <p>E.g. we have:</p>
  
  <p>backend branches:</p>
  
  <ul>
  <li>master</li>
  <li>release/2017.2</li>
  </ul>
  
  <p>frontend braches:</p>
  
  <ul>
  <li>master</li>
  <li>release/2017.2</li>
  </ul>
  
  <p>In the pipeline editor, I found a <strong>Build Triggers</strong> option and set it as follows: <strong>Build after other projects are built</strong> > <em>Projects to watch</em>: frontend, backend > Check <em>Trigger only if build is stable</em> or better in my test environment full of failures <em>Trigger even if the build is unstable</em>.</p>
  
  <p>Searching further, I found <a href="https://wiki.jenkins.io/display/JENKINS/Copy+Artifact+Plugin" rel="nofollow noreferrer">Copy Artifact Plugin</a></p>
  
  <p>But now the big question, <strong>how to fetch the last successful artifacts from these pipelines with the same git branch name</strong>?</p>
  
  <p>Because we don't want to mix e.g. a backend build of "release/2017.2" with frontend "master", it has to find as the last successful build having the same relationship or parameter or whatever you wanna call it, in our case the association is the git branch name.</p>
  
  <p>Is it possible to achieve this? If yes, how?</p>
  
  <p>The copy artifact plugin seems to work in a freestyle project. Would it work in a pipeline? That's also a concern...</p>
  
  <p>Thanks</p>