简体   繁体   English

在一项Jenkins CI工作中轮询许多SVN项目

[英]Polling many SVN projects in one Jenkins CI job

I have a situation where a chain of Java projects in SVN need to be built for continuous integration. 我遇到的情况是,需要在SVN中构建一系列Java项目以实现持续集成。 The projects can exist in multiple branches, and I want to perform CI builds on all of them. 这些项目可以存在于多个分支中,我想在所有这些分支上执行CI构建。 However, I would rather not have a different Jenkins project for each Java projects/SVN branch combination. 但是,我希望每个Java项目/ SVN分支组合都没有一个不同的Jenkins项目。 What I have done is to create Jenkins projects that take the SVN branch as a parameter, and set up the project dependency chain, passing the branch parameter along. 我要做的是创建将SVN分支作为参数的Jenkins项目,并建立项目依赖关系链,并将分支参数传递给它。 (I am using Ivy for this project, rather than Maven, so I don't have a plugin to do that for me.) I set up a chain kickoff job for each branch which defines the branch parameter and starts automatically several times each day. (我在此项目中使用的是Ivy,而不是Maven,所以我没有插件可以为我做。)我为每个分支设置了一个链启动工作,该分支定义了分支参数,并且每天自动启动几次。

PROS: This allows me to create a single Jenkins kick-off project for each branch, rather than the entire chain of projects. 优点:这使我可以为每个分支机构创建一个Jenkins启动项目,而不是整个项目链。

CONS: The build happens on a schedule, rather than as a result of SVN polling. 缺点:构建按计划进行,而不是SVN轮询的结果。 This means all the branches build multiple times a day, even if no changes have been made in that branch. 这意味着所有分支每天都会创建多次,即使该分支没有进行任何更改。

What I would like to happen ideally is have the kickoff project poll ALL the projects in the chain periodically, and build the chain if there are any changes. 我理想的情况是让启动项目定期轮询链中的所有项目,并在有任何更改的情况下构建链。 Is there a way to do that? 有没有办法做到这一点? Would it be as simple as specifying all the project locations in the kickoff project (using the branch parameter) and then specify polling as the build trigger? 是否简单到在启动项目中指定所有项目位置(使用branch参数)然后将轮询指定为构建触发器?

If I understand correctly: you want to poll a number of SVN locations from your "kickoff" job, but you don't want your "kickoff" job to actually checkout all those SVN locations? 如果我理解正确:您想从“启动”工作中轮询多个SVN位置,但是您不希望您的“启动”工作实际上检出所有这些SVN位置吗?

You can configure the "kickoff" job, give it all possible SVN locations (or a top-level location, such as /branches/ that will have all branches under it), and set the checkout depth to empty . 您可以配置“启动”作业,为其提供所有可能的SVN位置(或顶层位置,例如/branches/ ,该目录下将包含所有分支),并将结帐深度设置为empty Then configure SCM polling on this job. 然后在此作业上配置SCM轮询。 It will poll all SVN locations, but won't actually perform the lengthy checkout. 它将轮询所有SVN位置,但实际上不会执行冗长的结帐。 Once SCM changes are detected, your kickoff job will start, and trigger the rest of your chain 一旦检测到SCM更改,您的启动工作将开始,并触发整个链

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

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