有 jenkins
parameterized job .
并且定义了两个属性
-
选择类型的Property1(具有不同的配置)
-
具有多选的扩展选择属性2,选择值作为Groovy脚本的源(每个配置具有不同测试套件的列表) . 参考this jenkins插件 .
想 show the different list of values in Property2 based on the value selected for Property1.
试图在Property2的Groovy脚本中访问 Property1
, $Property1
, %Property1%
. 但是,似乎没有用 .
脚本看起来像下面的东西
if ($Property1 == 'configuration1') {
return ['suite1','suite2', 'suite3']
} else if ($Property1 == 'configuration2') {
return ['suite3', 'suite4']
} else if ($Property1 == 'configuration3') {
return ['suite5', 'suite6']
}
甚至将简单列表返回到 Property2
似乎也不像Groovy Script那样起作用 return ['suite1', 'suite2']
(只是试图显示值列表而不检查条件) . 我错过了什么吗?
1 回答
你可以试试Jenkins Active Choices plugin . 参数选项可以从Groovy脚本动态生成,并可以响应其他作业参数的更改 .