How do you run stages in parallel in a Jenkins declarative pipeline?

IntermediateConceptJenkins
Answer

Use a parallel block inside a stage. Each child stage can have its own agent. Add failFast true so the other branches abort when one fails.

stage('Tests') {
  failFast true
  parallel {
    stage('Unit')        { steps { sh 'make unit' } }
    stage('Integration') { agent { label 'docker' } steps { sh 'make integration' } }
    stage('Lint')        { steps { sh 'make lint' } }
  }
}

Parallel branches compete for executors, so more parallelism only helps if agents are available.

All CI/CD questions

More on Jenkins