我在 jenkins 中运行 groovy,我想从功能中拆分数据。我试图用变量名和值创建一个映射,但它看起来像函数内部的函数搞砸了。我想在不复制代码的情况下提取 CurrentBuildNo、ProjectName、Results_Folder(它们对于每个并行运行都不同)。
autotests = parallel (
{ ignore(ABORTED) {
retry ( 2 ) {
build("AutoTest", CurrentBuildNo: CurrentBuildNo, ProjectName: params["ProjectName"], Results_Folder: Results_Folder)
} } },
{ ignore(ABORTED) {
retry ( 2 ) {
build("AutoTest", CurrentBuildNo: CurrentBuildNo, ProjectName: params["ProjectName"], Results_Folder: Results_Folder)
} } }
)
我想要的逻辑是这样的:
tests = {{CurrentBuildNo: CurrentBuildNo, ...},{CurrentBuildNo: CurrentBuildNo, ...}}
autotests = parallel (
for (i in tests){
ignore(ABORTED) {
retry ( 2 ) {
build("AutoTest", test[i]['CurrentBuildNo'], test[i]['ProjectName']...)
} } }
}
)