我正在尝试使用特定的代理标签在声明式管道中运行动态阶段,我的脚本并行运行,但它会拾取随机节点,而不是我想要使用的节点。
下面的代码
def TestNames = []
def TestIDs = []
def tests = [:]
try{
File fh2 = new File("//x/Tests.txt")
def lines = fh2.readLines()
for (line in lines) {
TestNames << line.split(",")[0]
TestIDs << line.split(",")[1]
}
}
catch(FileNotFoundException e)
{
println e.toString()
}
pipeline {
agent {
node { label 'MC_1' }
}
stages {
stage('1') {
steps {
script {
for (i=0;i< TestNames.size();i++) {
tests["${TestNames[i]}"] = {
node { label 'MC_1' //}
stage("${TestNames[i]}") {
bat """
java -version
"""
}
}
}
parallel tests
}
}
}
}
}