Interview Prep/Jenkins/Declarative pipeline syntax

How does `parallel` work in declarative, and what is `failFast`?

IntermediateConceptDeclarative pipeline syntax
Answer

A stage containing parallel runs its child stages concurrently, each optionally with its own agent. failFast true (or options { parallelsAlwaysFailFast() }) aborts the other branches as soon as one fails.

stage('Checks') {
  failFast true
  parallel {
    stage('Unit') { steps { sh 'npm test' } }
    stage('Lint') { steps { sh 'npm run lint' } }
    stage('Audit') { steps { sh 'npm audit --audit-level=high' } }
  }
}

A stage cannot have both steps and parallel.

All Jenkins questions Roadmap: Jenkins

More on Declarative pipeline syntax