我没有。工作,我想同时开始。詹金斯是否可行?我尝试使用DSL插件,工作流程插件。我使用'并行'方法。我有一个数组/列表中的工作名列表,并希望并行运行它们。请帮忙。
目前我正在迭代数组中的作业名,因此它们逐个启动,而我希望它们开始并行。如何实现这一目标?
答案 0 :(得分:1)
这将满足您的要求
GParsPool.withPool(NO.OF.THREADS){
sampleList.eachParallel{
callYourMethod(it)
}
}
答案 1 :(得分:0)
我以前做过这件事。我发现对我有用的解决方案是使用上游/下游工作,使用Build Pipeline Plugin进行可视化。
基本上,创建一个空白' bootstrap'用于启动并行运行所需的所有作业的作业,每个并行作业都将引导作业作为上游触发器。
答案 2 :(得分:0)
我们用来并行触发多个作业的选项是https://wiki.jenkins-ci.org/display/JENKINS/Parameterized+Trigger+Plugin我们有一个主作业,只需要一个逗号分隔的所有作业列表。
答案 3 :(得分:0)
在我看来,最好的方法(这将提升你的个人技能;-))是使用Jenkins Pipeline !!
您可以在
下面找到一个简单的代码示例// While you can't use Groovy's .collect or similar methods currently, you can
// still transform a list into a set of actual build steps to be executed in
// parallel.
// Our initial list of strings we want to echo in parallel
def stringsToEcho = ["a", "b", "c", "d"]
// The map we'll store the parallel steps in before executing them.
def stepsForParallel = [:]
// The standard 'for (String s: stringsToEcho)' syntax also doesn't work, so we
// need to use old school 'for (int i = 0...)' style for loops.
for (int i = 0; i < stringsToEcho.size(); i++) {
// Get the actual string here.
def s = stringsToEcho.get(i)
// Transform that into a step and add the step to the map as the value, with
// a name for the parallel step as the key. Here, we'll just use something
// like "echoing (string)"
def stepName = "echoing ${s}"
stepsForParallel[stepName] = transformIntoStep(s)
}
// Actually run the steps in parallel - parallel takes a map as an argument,
// hence the above.
parallel stepsForParallel
// Take the string and echo it.
def transformIntoStep(inputString) {
// We need to wrap what we return in a Groovy closure, or else it's invoked
// when this method is called, not when we pass it to parallel.
// To do this, you need to wrap the code below in { }, and either return
// that explicitly, or use { -> } syntax.
return {
node {
echo inputString
}
}
}