简体   繁体   English

如果svn轮询失败,请不要执行jenkins作业

[英]Don't execute jenkins job if svn polling failed

I have a jenkins job, that is polling svn every 5 minutes and executing my unittests if some changes occured. 我有一个詹金斯工作,每5分钟轮询一次svn,如果发生某些更改,请执行我的单元测试。

My probleme is, the svn polling fails randomly due to a unreachable proxy. 我的问题是,由于代理无法访问,svn轮询随机失败。

org.tmatesoft.svn.core.SVNAuthenticationException: svn: E170001: HTTP proxy authorization failed

I guess this problem is related to some issues with the proxy we use and not the configuration of my job or machine. 我猜这个问题与我们使用的代理有关,而不是与我的工作或机器的配置有关。

My question now is, can I skip the job if the svn poll is failing and only execute if it was succesful? 我现在的问题是,如果svn poll失败,我可以跳过该作业,而仅在成功的情况下才执行? So that I don't have failed builds in my job list because of the proxy issue. 这样我就不会因为代理问题而使我的工作列表中的构建失败。

Or does anyhow have an idea why this random error can occure? 还是以某种方式知道为什么会发生此随机错误?

Fyi, I don't want the proxy problem itself fixed, as this is probably happening due to network problems, but I just want to skip the execution of the job if the svn poll fails. Fyi,我不希望代理问题本身得到解决,因为这可能是由于网络问题而发生的,但是我只想在svn poll失败时跳过作业的执行。

Instead of polling svn, you can try a post-commit hook so that svn notifies Jenkins of changes; 除了轮询svn之外,您还可以尝试使用post-commit挂钩,以便svn通知詹金斯更改。 see https://wiki.jenkins-ci.org/display/JENKINS/Subversion+Plugin?focusedCommentId=43352266 参见https://wiki.jenkins-ci.org/display/JENKINS/Subversion+Plugin?focusedCommentId=43352266

In order to prevent running next action when the previous action is failed, add set +e to the top of your shell script. 为了防止在前一个操作失败时运行下一个操作,请在您的Shell脚本顶部添加set + e。 -e option is exit immediately when any action returns 1(which means failed). -e选项在任何操作返回1(表示失败)时立即退出。 And also. 并且。 @mikep's answer is useful thought. @mikep的答案是有用的想法。 Instead of polling, Post-commit hook is more efficient. 提交后挂钩比轮询更有效。

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

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