title: How can I limit number of certain pipelines running in parallel?
body: <p>I want to allow running following pipeline in parallel, but I have to limit maximum number of parallel runs due to limited resources.</p>
  
  <pre><code>pipeline {
  
    agent { label "$JENKINS_AGENT" }
    parameters { .. }
    options { .. }
  
    stages {
      stage('Checkout') { .. }
      stage('Config') { .. }
      stage('Deploy') { .. }
      stage('Test') { .. }
    }
  
    post {
      failure { .. }
      success { .. }
      always {
        cleanup()
      }
    }
  }
  </code></pre>
  
  <p>For example if I am limited to 3 deployments, how could I achieve this?</p>
  
  <p><em>Edit</em>: I have added currently the following to my jenkinsfile. Seems to work, but I'm not sure if that's the correct way to do this. <em>(using <a href="https://github.com/jenkinsci/throttle-concurrent-builds-plugin/blob/master/README.md" rel="noreferrer">Throttle Concurrent Builds Plugin</a>)</em></p>
  
  <pre><code>properties([
    [
      $class: 'ThrottleJobProperty',
      categories: ['parallel_pipeline'],
      limitOneJobWithMatchingParams: false,
      maxConcurrentPerNode: 3,
      maxConcurrentTotal: 3,
      paramsToUseForLimit: '',
      throttleEnabled: true,
      throttleOption: 'project'
    ],
  ])
  </code></pre>