, , , ...
/, , , .
- . , .
: OPS , . Groovy, , , , , , , , , , .
, matrixBuilder , . . , .
matrixBuilder . (, ).
def axisList = [
["ubuntu","rhel","windows","osx"],
["jdk6","jdk7","jdk8"],
["banana","apple","orange","pineapple"]
]
def tasks = [:]
def comboBuilder
def comboEntry = []
def task = {
def myAgent = it[0]
def myJdk = it[1]
def myFruit = it[2]
return {
node(myAgent) {
println "Executing combination ${it.join('-')}"
def javaHome = tool myJdk
println "Node=${env.NODE_NAME}"
println "Java=${javaHome}"
}
node {
println "fruit=${myFruit}"
}
}
}
comboBuilder = { def axes, int level ->
for ( entry in axes[0] ) {
comboEntry[level] = entry
if (axes.size() > 1 ) {
comboBuilder(axes[1..-1], level + 1)
}
else {
tasks[comboEntry.join("-")] = task(comboEntry.collect())
}
}
}
stage ("Setup") {
node {
println "Initial Setup"
}
}
stage ("Setup Combinations") {
node {
comboBuilder(axisList, 0)
}
}
stage ("Multiconfiguration Parallel Tasks") {
parallel tasks
}
stage("The End") {
node {
echo "That all folks"
}
}
http://localhost: 8080/job/multi-configPipeline/[build]/flowGraphTable/ ( " " .
: "", , , .
...
return {
// This is where the important work happens for each combination
stage ("${it.join('-')}--build") {
node(myAgent) {
println "Executing combination ${it.join('-')}"
def javaHome = tool myJdk
println "Node=${env.NODE_NAME}"
println "Java=${javaHome}"
}
//Node irrelevant for this part
node {
println "fruit=${myFruit}"
}
}
}
...
node
stage
.
, ( ). comboEntry
. , , , , , , . tasks[comboEntry.join("-")] = task(comboEntry.collect())
.
, stage ("Multiconfiguration Parallel Tasks") {}
. . , , . , "" .
, " " , - , . , .
, , , , . "" , ( ) "", . , .