简体   繁体   中英

Conditional svn checkout in polling Jenkins job

I am trying to prevent an svn checkout on an svn-polling Jenkins job depending on a condition. Pre-steps are executed after the checkout and this job is triggered through svn polling. Please advise.

There is a plugin that allows to execute a step before SVN checkout
https://wiki.jenkins-ci.org/display/JENKINS/pre-scm-buildstep
However, it does not prevent the job from continuing even if those pre-scm steps fail. Latest versions allow to fail the build if this pre-build step fails.

One thing I can think of is to setup 2 jobs. One job's task is solely to poll SVN, and if conditions are met, then trigger a build using the second job. The second job can even use "custom workspace" option and use the workspace of the first job to prevent additional checkouts

I don't know if it is still relevant, but I might have found a workaround for this problem.Let say that you have an SVN repo with a root called 'svn_root' and under it you have you trunk folder, your tag folder, your branch folder, etc.
You only want Jenkins to poll your 'svn_root' without having to checkout the content of your trunk/tags/branch.To do so, in your job configuration, in the subversion part, put in your 'repository url' box your high level url (eg: svn://ip/svn_root) and in the 'repository depth' dropdown choose 'immediates'.When the job will start, jenkins will only check the high level folder (svn_root) and will trigger only if there was a change in it.By example, if there was a commit in the trunk, the trunk entry of the high level folder will change, and the job will be triggered.
That completely did the trick for me.
Hope I helped
Good luck

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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