简体   繁体   English

当 Mercurial 更新失败时,如何使 Jenkins 构建失败

[英]How to fail Jenkins build when Mercurial Update fails

I have a Jenkins build that checks code out of Mercurial. There was a situation where the Mercurial repo was corrupted and updates were failing, however Jenkins build would still continue and report Success.我有一个 Jenkins 构建,用于检查 Mercurial 中的代码。有一种情况是 Mercurial 存储库已损坏并且更新失败,但是 Jenkins 构建仍会继续并报告成功。 Is it possible to fail the Jenkins build in this case?在这种情况下,Jenkins 构建是否可能失败?

I have experienced a similar issue using SVN.我在使用 SVN 时遇到过类似的问题。

Assuming that Mercurial outputs a warning/error when the update fails, you can use the Text Finder plugin: https://wiki.jenkins-ci.org/display/JENKINS/Text-finder+Plugin to parse for the warning message and fail if found.假设 Mercurial 在更新失败时输出警告/错误,您可以使用 Text Finder 插件: https://wiki.jenkins-ci.org/display/JENKINS/Text-finder+Plugin来解析警告消息并失败如果找到。

Alternatively, if Mercurial outputs a success message on successful update, you could parse for that and fail if the success message is NOT found.或者,如果 Mercurial 在成功更新时输出成功消息,您可以对此进行解析,如果未找到成功消息则失败。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM