Sunday, July 2, 2017

Don't execute jenkins job if svn polling failed

Leave a Comment

I have a jenkins job, that is polling svn every 5 minutes and executing my unittests if some changes occured.

My probleme is, the svn polling fails randomly due to a unreachable proxy.

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? 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.

2 Answers

Answers 1

Instead of polling svn, you can try a post-commit hook so that svn notifies Jenkins of changes; see https://wiki.jenkins-ci.org/display/JENKINS/Subversion+Plugin?focusedCommentId=43352266

Answers 2

In order to prevent running next action when the previous action is failed, add set +e to the top of your shell script. -e option is exit immediately when any action returns 1(which means failed). And also. @mikep's answer is useful thought. Instead of polling, Post-commit hook is more efficient.

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment