neves
neves

Reputation: 39153

In Jenkins pipeline parallel stages, how to promptly kill other stages if one fail?

If the job failed, I don't have to wait everybody to finish. Is it possible to abort the parallel stages that are still running. They must display as "aborted", not with a red cross icon, since the failed one must be highlighted.

Upvotes: 11

Views: 10034

Answers (1)

Michael Kemmerzell
Michael Kemmerzell

Reputation: 5256

Add parallelsAlwaysFailFast to your options{} and the whole pipeline will stop if any (parallelized) stage fails.

parallelsAlwaysFailFast Set failfast true for all subsequent parallel stages in the pipeline.

For example: options { parallelsAlwaysFailFast() }

Example:

pipeline {
  agent none
  options {
    parallelsAlwaysFailFast()
  }
  stages {
     ...
  }
}

The option highlights the failed stage. Unfortunately the other stages are not displayed as aborted they just get the usual (not highlighted) red color.

Upvotes: 14

Related Questions