I have pipeline which has dynamic parallel stages and I want my pipeline to fail fast, if any of the stage fail. I tried to add failFast: true but my pipeline is stuck at "Failed at Stage ABC".
stage("Deploy") {
steps {
script {
def stages = createStages("Name", "Project")
fastFail: true
for (stage in stages) {
parallel stage
}
}
}
}
Solution: Use
failFastflag on Jenkins pipeline.Pay attention that all jobs would be triggered and quit (if one fails) if the agent node was started in each one of them (if job 'a' in pipeline fails but job 'b' is still looking for node and not started yet, it will continue - [this is an edge case]).
Examples - The options are :
1.Use parallelsAlwaysFailFast method in your options pipeline:
2.Use before parallel using
failFast true3.Configure jobs in map and execute with failFast attribute on.