我有这个测试代码,它按预期在build_servers
节点上的不同执行程序上运行2个构建。
pipeline {
agent { label 'myserver' }
stages {
stage('1') {
steps {
script {
def tests = [:]
for (f in [ 'x', 'y' ]) {
tests["${f}"] = {
node('build_servers') {
stage('Clean Workspace') {
echo "cleaning up Ws ${f}"
step([$class: 'WsCleanup'])
}
stage('create Wspace txt file') {
script {
props="Wspace=${workspace}"
dir ( 'wspace') {
writeFile file: 'params.txt', text: props
}
}
}
stage('Run other job') {
script {
println('calling other project')
props = readProperties file: "wspace/params.txt"
file_params = props.collect {
string(name: it.key, value: it.value)
}
build job: "other_job2", parameters: file_params, wait: true, propagate: true
}
}
}
}
}
parallel tests
}
}
}
}
}
我希望它在other_job2
上触发2个不同的版本,但是它只提交一个作业,而两个tests['x'] and tests['y']
都等待相同的作业完成,为什么?是否不应该在other_job2
项目中创建2个不同的工作,一个为x
,另一个为y
?