node {?
// 在Jenkinsfile定義服務(wù)和副本數(shù)量的關(guān)系
def sampleMap = [:]
sampleMap.put('dyedp-crm-opportunityservice',3)
sampleMap.put('dyedp-crm-organizationservice',2)
sampleMap.put('dyedp-tc-calculateservice',3)
//定義變量動態(tài)獲取服務(wù)名
def serviceName ='dyedp-crm-opportunityservice'
// 三元運算 如果服務(wù)名在samplemap中蹭劈,就取其值展辞,如果不在禁灼,就設(shè)置為1print(sampleMap[serviceName]==null?1:sampleMap[serviceName])
}