I have a build flow which builds 4 jobs in sequence
eg;
build(Job 1)
build(Job 2)
build(Job 3)
build(Job 4)
I want to run Job 4 even if any of the previous job fails also . How can I do that in the build flow ?
I have a build flow which builds 4 jobs in sequence
eg;
build(Job 1)
build(Job 2)
build(Job 3)
build(Job 4)
I want to run Job 4 even if any of the previous job fails also . How can I do that in the build flow ?
you can set propagate to false, that will ensure your workflow will continue if particular job fails:
build job: '<job_name>', propagate: false
You can use Jenkins Workflow Plugin as follows:
try {
build 'A'
} catch(e) {
echo 'Build for job A failed'
}
try {
build 'B'
} catch(e) {
echo 'Build for job B failed'
}
You can extend this idiom to any number of jobs or any combination of success/failure flow you want (for example, adding build
steps inside catch
es if you want to build some job in case another failed).