title: Jenkins pipeline: How to force a build to wait for previous build to finish
body: <p>I have a Jenkins pipeline that automatically builds the latest code from a Git repository whenever there's a code update. The problem is that sometimes there are 2 or more code updates happening at (almost) the same time, which causes 2 builds to run in parallel. </p>
  
  <p>I assume this won't happen if I set the number of executors in my node to 1, but I don't want to do that.</p>
  
  <p>Is there any way to make sure a build only starts when previous build (of the same job/pipeline) is finished? </p>