如果出现“BUILD FAILED”消息,如何退出Jenkins管道

sqserrrh  于 2022-11-21  发布在  Jenkins
关注(0)|答案(1)|浏览(188)

在管道的一个阶段中,在日志中出现了一条生成失败的消息,稍后又出现了一条生成成功的消息。我希望管道在看到生成失败的消息时停止,而不要继续,因为如果继续,它将看到生成成功,而不会停止,我们将不知道日志中存在问题
Build Failed message
Build Success Image

holgip5t

holgip5t1#

重新审视Jenkins文档:-
我发现两个参数必须为true,才能让已触发作业的状态影响管道

propagate : boolean (optional)
If enabled (default state), then the result of this step is that of the downstream build (e.g., success, unstable, failure, not built, or aborted). If disabled, then this step succeeds even if the downstream build is unstable, failed, etc.; use the result property of the return value as needed.

wait : boolean (optional)
If true, the pipeline will wait for the result of the build step before jumping to the next step. Defaults to true.

我的最终代码,即(SCM结帐工作):-

build job: 'FrontEnd_Checkout', wait: true, propagate: true, parameters: [string(name: 'BRANCH_NAME', value: "${env.frontend_branch}")]

相关问题