好的,我下载了这个插件:
https://wiki.jenkins-ci.org/display/JENKINS/Extended+Choice+Parameter+plugin
并选择'Multi-Level Single Select‘作为参数类型。
问题是,当我选择了多个参数,并且我想在一个构建中的shell中使用这些参数时,我只能选择最后一个参数
因此,如果我执行$PARAM_NAME,它只输出最后一个参数,但我想要我选择的所有参数,而不仅仅是最后一个参数!
请帮帮我!
编辑:演示图片

发布于 2014-01-24 08:49:00
您不是基于选择来构建参数,而是导航到所需的值。即国家->州->城市
您不是在构建CountryStateCity变量,而是在声明City变量是您选择的值。
发布于 2019-07-11 21:49:47
我可以通过使用Extended Choice Parameter > JSON Parameter Type > JSON Parameter Config Groovy Script获得最接近的结果。
import org.boon.Boon;
def jsonEditorOptions = Boon.fromJson(/{
disable_edit_json: true,
disable_properties: true,
no_additional_properties: true,
disable_collapse: true,
disable_array_add: false,
disable_array_delete: false,
disable_array_reorder: false,
theme: "bootstrap3",
iconlib: "fontawesome5",
schema: {
"type": "object",
"title": "",
"required": [
"Locations"
],
"properties": {
"Locations": {
"type": "array",
"format": "table",
"title": "",
"uniqueItems": true,
"items": {
"type": "object",
"title": "Location",
"properties": {
"Country": {
"type": "string",
"propertyOrder" : 1,
"enum": [
"USA",
"Germany",
"India"
]
},
"City": {
"type": "string",
"propertyOrder" : 2,
"enum": [
"New York",
"Frankfurt",
"Mumbai"
]
},
"Neighborhood": {
"type": "string",
"propertyOrder" : 3
}
}
},
"default": [{
"Country": "USA",
"City": "New York",
"Neighborhood": "Times Square"
}]
}
}
}
/);如上所述,您可以访问plugin page和json-editor.github.io来创建和验证您的
模式。
下面是它在Jenkins中的显示方式:

请注意,它仍然不提供基于在第一列中选择的内容的上下文相关的第二列。第二列的行为与第一列完全相同,在第一列中,您可以从预定义的列表中进行选择,而不需要任何过滤器。
在打印变量Location时,它返回以下JSON:
{"Locations":[{"City":"New York","Country":"USA","Neighborhood":"Times Square"},{"City":"Frankfurt","Country":"Germany","Neighborhood":"Bornheim"},{"City":"Mumbai","Country":"India","Neighborhood":"Vile Parle"}]}发布于 2020-01-20 15:21:09
我遇到了同样的问题,所以我在参数文件中添加了一个“行号”列:
Country City Row
United States San Francisco 1
United States Chicago 2
Mexico Mexico City 3
Mexico Cancun 4这样,插件返回行号,我可以从参数文件中寻址该行。
https://stackoverflow.com/questions/21003160
复制相似问题