i want to use 3 pipelines and if anything fails in the 3rd pipeline, i want to continue or resume building from the third pipeline. how to do that???
What should I use to do that?
I think you could achieve this by using Jenkins’ catchError
or try/catch
block in your pipeline script. This allows the pipeline to continue running even if a step fails.
Here’s a basic example of how you could structure your pipeline:
pipeline {
agent any
stages {
stage('Pipeline 1') {
steps {
// Your steps for Pipeline 1
}
}
stage('Pipeline 2') {
steps {
// Your steps for Pipeline 2
}
}
stage('Pipeline 3') {
steps {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
// Your steps for Pipeline 3
}
}
}
}
}
In this example, if anything fails in the ‘Pipeline 3
’ stage, the build result will be set to ‘SUCCESS
’ and the stage result will be set to ‘FAILURE
’.
This means that the build will continue even if there’s a failure in ‘Pipeline 3’.