title: conditional build based on branch for multi stage pipeline using different templates under stages
body: <p>How to trigger by branch to use specific template under "stages"?</p>
  
  <p>trigger:</p>
  
  <pre><code> branches
  
     include:
  
       - ci
  
       - prod
  </code></pre>
  
  <p>stages:</p>
  
  <ul>
  <li><p>template: ci.yml</p>
  
  <p>condition: and(eq(['build.sourceBranch'], 'ci'))</p></li>
  <li><p>template: prod.yml</p>
  
  <p>condition: and(eq(['build.sourceBranch'], 'prod'))</p></li>
  </ul>
  
  <p>Tried above condition but didn't work. I was getting "unexpected value condition". Any help is appreciated</p>
  
  <p>***** Tried one of the solution as by passing condition as parameter to the template:</p>
  
  <p>stages:</p>
  
  <ul>
  <li><p>template: ci.yml</p>
  
  <p>parameters:</p>
  
  <p>condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/ci'))</p></li>
  <li><p>template: prod.yml</p>
  
  <p>parameters:</p>
  
  <p>condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/prod'))</p></li>
  </ul>
  
  <p>Getting "unexpected parameter condition"</p>
  
  <p>Pipeline structure:</p>
  
  <p><strong>master.yml (contains runtime parameters)</strong>
  stages:</p>
  
  <p>template: ci.yml</p>
  
  <p>parameters:</p>
  
  <p>condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/ci'))</p>
  
  <p>template: prod.yml</p>
  
  <p>parameters:</p>
  
  <p>condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/prod'))</p>
  
  <p><strong>ci.yml</strong></p>
  
  <p>stages:</p>
  
  <ul>
  <li><p>stage: BuildApp</p></li>
  <li><p>stage: BuildWeb</p></li>
  <li><p>stage: DeployLocal</p></li>
  </ul>
  
  <p><strong>prod.yml</strong></p>
  
  <p>stages:</p>
  
  <ul>
  <li><p>stage: BuildApp</p></li>
  <li><p>stage: BuildWeb</p></li>
  <li><p>stage: DeployProd</p></li>
  </ul>