[英]Jenkins Active Choices Parameter plugin not working as expected
I have a hidden parameter
in Jenkins
called platformType
. 我在Jenkins
有一个名为platformType
的hidden parameter
。 I want to display choices based on the parameter platformType
. 我想显示基于参数platformType
选择。 I created the following groovy script but it doesn't work 我创建了以下常规脚本,但是它不起作用
if (platformType.equals("android")) {
return ['7.0', '6.0']
} else (platformType.equals("ios")) {
return ['10.0', '9.0']
}
quite sure you did not specify the platformType
as a parameter to platformVersion
or you have other error in your code.. 肯定你没有指定platformType
作为参数传递给platformVersion
或者你有其他错误在你的代码..
without error handling you just don't see it. 没有错误处理,您只是看不到它。
in your script you can catch the exception like this: 在脚本中,您可以捕获如下异常:
try {
if (platformType.equals("android")) {
return ['7.0', '6.0']
} else if(platformType.equals("ios")) {
return ['10.0', '9.0']
}
}catch(e){ return [e.toString()] }
in this case you'll see the error in your choice field 在这种情况下,您会在选择字段中看到错误
Looks you are missing if
in the else part. 看起来您if
在其他部分丢失。
It is supposed to be: 应该是:
if ('android' == platformType) {
return ['7.0', '6.0']
} else if ('ios' == platformType) {
return ['10.0', '9.0']
} else return []
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.