https://jenkins.io/doc/pipeline/examples/#jobs-in-parallel
问题:
并行处理多个节点 job,node在数组中添加
问题:
并行处理多个节点 job,node在数组中添加
Synopsis
This is a simple example showing how to succinctly parallel the same build across multiple Jenkins nodes. This is useful for e.g. building the same project on multiple OS platforms.
def labels = ['precise', 'trusty'] // labels for Jenkins node types we will build on def builders = [:] for (x in labels) { def label = x // Need to bind the label variable before the closure - can't do 'for (label in labels)' [popexizhi:这里x是地址引用,如果做列表复制,一定要做局部变量] // Create a map to pass in to the 'parallel' step so we can fire all the builds at once builders[label] = { node(label) { // build steps that should happen on all nodes go here } } } parallel builders
没有评论:
发表评论