1
我想在具有相同標籤的所有代理中的Jenkins管道中運行特定任務。爲了這個目的我得到了下面的代碼。但它沒有按預期工作。 它只在標籤爲「my_label」的第一個從站中運行,然後退出。我需要用這個標籤在所有詹金斯奴隸上運行這個工作。Jenkinsfile:在所有具有相同標籤的代理中運行任務
任何幫助將不勝感激。
def labels=["my_label"] def builders=[:] for (x in labels) {
def label=x builders[label]= {
node(label) {
// build steps that should happen on all nodes go here
// Step 4
stage('Run deployment on all agents in the given environment') {
sh "echo Run deployment" sh "echo release_version = ${params.release_version}" sh "echo environment = ${params.environment}"
}
}
}
}
parallel builders
感謝, 阿倫小號