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.
More on Declarative pipeline syntax
What is the minimum valid declarative pipeline?BeginnerWhat agent types exist in declarative pipelines?IntermediateWhen do you use `agent none` at the top level?IntermediateHow do nested sequential stages work and why are they useful?IntermediateList the `post` conditions and when each fires.IntermediateWhat are the most useful `when` conditions?Intermediate