与许多奴隶并行分布——这个概念在詹金斯中如何运作?

Distributed parallel with many slaves -- how does this concept work in jenkins?

我在管道中遇到了一个选项,如果我们不提及节点名称而只提及节点,jenkins 将智能地找到哪个节点空闲并将作业分配给其中一个空闲节点。下面的示例代码。

parallel (
    "stream 1" : { 
        node {
            build 'Job1'
        }
    },
    "stream 2" : {
        node {
            build 'Job2'
        }
    }
)

我能否获得有关它如何工作的更多信息,我们能否提供一个节点列表,从中选择一个空闲节点? 是否会使用一个slave中的所有执行器?

参考文档:https://www.cloudbees.com/blog/parallelism-and-distributed-builds-jenkins

您可以通过将相同的标签分配给多个节点,让 Jenkins select 您的一个节点来自子集。

此选项可在 "Manage Jenkins -> Manage Nodes -> {Select one of the nodes} -> Configure" 下找到。

您可以像下面的示例那样使用标签,而不是 select 按名称创建节点。

parallel (
"stream 1" : { 
    node('linux') {  // runs on one of the nodes labelled as linux nodes
        build 'Job1'
    }
},
"stream 2" : {
    node('named_node_foo'){  // only runs on node named_foo_node
        build 'Job2'
    }
}

)