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

橙三吉。 提交于 2020-08-06 17:29:40

问题


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.


回答1:


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

Quoting the source:

parallelsAlwaysFailFast

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

For example: options { parallelsAlwaysFailFast() }

Example how to use in the pipeline:

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.



来源:https://stackoverflow.com/questions/54698697/in-jenkins-pipeline-parallel-stages-how-to-promptly-kill-other-stages-if-one-fa

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!