詹金斯建立循环清单 [英] Jenkins builds loop list
问题描述
我正在尝试找到一种具有一个参数列表的方法,并让Jenkins为该列表中的每个项目创建作业或运行构建.
I am trying to figure out a way to have one list of parameters, and have Jenkins create a job or run a build for each of the items in the list.
该参数是一个目录,因此我有一个目录列表,并且我希望它能够正常工作,因此对于每个目录,构建都需要执行几个步骤-因此,基本上对于每个目录,请运行git pull,ant命令,ant命令,带有目录名称的ant命令,发布测试结果,进行下一步构建.
The parameter is a directory, so I have a list of directories, and I want it to work so for each of them, the build runs several steps - so basically for each directory, run git pull, ant command, ant command, ant command with the directory name, publish test results, next build.
我看过很多插件,但是直到完成所有操作后,我才能弄清楚如何使它进入列表中的下一个项目.
I have looked at a bunch of plugins but I can't figure out how to do this to get it to go to the next item in the list until they're all done.
推荐答案
如果我正确理解您的工作?您可以使用BuildFlow插件使用不同的参数(目录)多次触发它.创建构建流程作业,并在此作业内部使用不同的参数调用您的作业.在构建流程作业中,您可以使用参数触发作业
if I understand correctly you have on job? You can trigger it multiple times with different parameters (directory) by using BuildFlow Plugin. Create build flow job and inside this job call your job with different parameters. In build flow job you can trigger your job with parameters
build("AntJob", parDirectory: "C:\src1")
build("AntJob", parDirectory: "C:\src2")
您还可以创建更智能的DSL并并行运行此作业
you can also create smarter DSL and run this job in parallel
def dirTable = [ "C:\src1", "C:\src2", "C:\src3"]
def builds = []
dirTable.each{ d ->
def clr = { build("AntJob", parDirectory: d) }
builds.add(clr)
}
parallel(builds)</code>
这篇关于詹金斯建立循环清单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!