How do you set the build result without failing the step?
IntermediateConceptDeclarative pipeline syntax
Answer
unstable(message: 'Coverage below 80%') // UNSTABLE, continue
catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') {
sh './integration-tests.sh'
}
warnError('Lint failed') { sh 'npm run lint' } // stage and build UNSTABLE
error('Missing release notes') // fail now
catchError lets the pipeline continue and marks the stage red but the build yellow, which is useful for non-blocking checks.
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