我在互联网上寻找一种方法来多次运行相同的管道,但没有找到答案。基本上,管道有5个阶段,我希望这个管道运行5次,管道的每次迭代将以相同的顺序执行代码中的阶段。
node{
def build_ok = true
try{
stage('#1 SoftSync 4.5.1 CPU Usage Test') {
build job: 'SoftSync_4.5.1_CPU_Usage_Test', parameters: [string(name: 'LOG_LEVEL', value: 'debug'), string(name: 'FILE_PATH', value: 'TLV_SoftSync/Management_Bundle/SoftSync_CPU_Usage_Test.robot')]
}
} catch(e) {
build_ok = false
echo e.toString()
}
try{
stage ('#2 SoftSync 4.5.1 Improvments to system time management Test '){
build job: 'SoftSync_4.5.1_Improvments_To_System_TimeManagement_Test', parameters: [string(name: 'LOG_LEVEL', value: 'debug'), string(name: 'FILE_PATH', value: 'TLV_SoftSync/Management_Bundle/SoftSync_Improvments_to_system_time_management.robot')]
}
}catch(e) {
build_ok = false
echo e.toString()
}
try {
stage ('#3 SoftSync 4.5.1 Telematics and statistics Test'){
build job: 'SoftSync_4.5.1_Telematics_and_statistics_Test', parameters: [string(name: 'LOG_LEVEL', value: 'debug'), string(name: 'FILE_PATH', value: 'TLV_SoftSync/Management_Bundle/SoftSync_Telementry_and_Statistics.robot')]
}
}catch(e) {
build_ok = false
echo e.toString()
}
//try{
//stage ('#4 SoftSync 4.5.1 PTP Profiles Slave Lock Test'){
build job: 'SoftSync_4.5.1_PTP_Profiles_SlaveLock_Test', parameters: [string(name: 'LOG_LEVEL', value: 'debug'), string(name: 'FILE_PATH', value: 'TLV_SoftSync/PTP_Bundle/SoftSync_PTP_Lock_validation.robot')]
//}
//}catch(e) {
// build_ok = false
// echo e.toString()
//}
try{
stage ('#5 SoftSync 4.5.1 Alarms Test'){
build job: 'SoftSync_4.5.1_Alarms_Test', parameters: [string(name: 'LOG_LEVEL', value: 'debug'), string(name: 'FILE_PATH', value: 'TLV_SoftSync/Management_Bundle/SoftSync_Alarms_Test.robot')]
}
}catch(e) {
build_ok = false
echo e.toString()
}
if(build_ok) {
currentBuild.result = "SUCCESS"
} else {
currentBuild.result = "FAILURE"
}
post{
always{
junit allowEmptyResults: true, testResults: '/var/lib/jenkins/output/*.xml'
}
}
}
我见过一些使用数组和。每个函数,但都是并行使用,这对我的情况没有帮助。
有什么主意吗?
1条答案
按热度按时间rhfm7lfc1#
你可以用一个循环来 Package 你的阶段。