Conditional svn checkout in polling Jenkins job

ε祈祈猫儿з 提交于 2019-12-10 17:34:19

问题


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.


回答1:


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




回答2:


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



来源:https://stackoverflow.com/questions/15010449/conditional-svn-checkout-in-polling-jenkins-job

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!