简体   繁体   English

Jenkins扩展选择参数插件Groovy脚本

[英]Jenkins Extended Choice Parameter Plugin Groovy Script

So in the website for the plugin , the change-log for Version 0.61 (Mar 30, 2016) mentions that they have exposed Jenkins and project bindings for use in a groovy script. 因此,在该插件网站上,版本0.61(2016年3月30日)的更改日志提到他们已经公开了Jenkins和项目绑定以用于groovy脚本。 I'm currently trying to set a parameter (multi select) and i want it to have different options based on the value of another parameter which is set before this one in the Jenkins job. 我当前正在尝试设置一个参数(多选),并且我希望它根据Jenkins作业中在此参数之前设置的另一个参数的值具有不同的选项。 However i'm not able to get the value of that other parameter in the script. 但是我无法在脚本中获取该其他参数的值。

My problem is very similar to the one explained here 我的问题与这里解释的问题非常相似

I've tried using ${param}, $(param), $param, bindings.variables.get('param') in the script, and none of it works 我试过在脚本中使用$ {param},$(param),$ param,bindings.variables.get('param'),但它们均无效

I've also tried to set that parameter in the Variable bindings section of the script but still no success. 我也尝试在脚本的变量绑定部分中设置该参数,但仍然没有成功。

Any ideas about the correct way to obtain the value? 关于获取价值的正确方法有什么想法?

I set the variable binding as param on the other field that you want to dynamically populate and used param (please note that i didnt use $ ${} or binding.get etc). 我将变量绑定设置为要动态填充的其他字段上的参数,并使用了参数(请注意,我没有使用$ $ {}或binding.get等)。 It worked for me. 它为我工作。

As a side note, Will active choice reactive parameter work in your case? 作为附带说明,主动选择反应参数是否适合您的情况?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM