title: Disable concurrent builds
body: <p><strong>Background</strong>: We are looking for a solution on how to optimize our pipeline (former workflow). </p>
  
  <p>Currently, we run quiet a few parallel deployments and tests which are spread on 2 builders, with 4 executors each. </p>
  
  <p>The pipeline is triggered by a Git push, so subsequent pushes will trigger multiple builds. We have experimented with the stage concurrency: 1 option, which nicely blocks a step by a subsequent build, but will kick of when that specific stage is done. </p>
  
  <p><strong>Question(s)</strong>:</p>
  
  <p>I am not sure this is best practise, but It seems to me, it would be better to not execute the new build, until the previous one is done. (Reasoning from the fact that we have committed resources to it, and it should be allowed to finished, even if it's not the latest and greatest commit).</p>
  
  <p>Q1: Is this even best practise? </p>
  
  <p>Q2: how do we pre-empt the new triggert build, while still running the previous one? (I can imagine iterating through the builds of this job and stopping the new one...). </p>
  
  <p>See the config of the first stage [1]</p>
  
  <p>[1] first stage.. </p>
  
  <pre><code>stage name: 'Checkout and build WAR'
  node {
      def mvnHome = tool 'Maven 3.2.x'
      checkout([$class                           : 'GitSCM',
            poll                             : true,
            branches                         : [[name: '*/master']],
            doGenerateSubmoduleConfigurations: false,
            extensions                       : [[$class           : 'RelativeTargetDirectory',
                                                 relativeTargetDir: 'checkout-directory']],
            submoduleCfg                     : [],
            userRemoteConfigs                : [[url: 'https://some.repo/repo.git']]])
  
  // Archive the cloned repo.
  stash name: 'src', includes: 'checkout-directory/war/src/, checkout-directory/war/pom.xml'
  
  // Run without tests, do the unit and integration tests in a separate stage.
  sh "${mvnHome}/bin/mvn -f checkout-directory clean install -DskipTests"
  
  // Archive the application build.
  stash name: 'war', includes: 'checkout-directory/war/target/*.war'
  }
  </code></pre>