我正在尝试创建一个“扩展选择配置”参数。我把我的代码放在"JSON参数Config Groovy脚本“中,但是我在”用参数构建“屏幕上看不到它。我尝试了这两种方法,普通的json和org.boon,但是没有得到同样的结果。


我使用的代码(用于org.boon)与可以在:https://wiki.jenkins.io/pages/viewpage.action?pageId=92736450上找到的代码相同
发布于 2020-09-15 15:42:13
用下面的代码替换您的配置groovy脚本,它就能工作了。扩展选择参数的JSON参数特性是基于https://github.com/json-editor/json-editor的
groovy脚本应该返回一个JSON对象,该对象对应于json编辑器中引用的"options“对象。
更新
确保扩展的名称选择参数" name“没有空格。因此,在您的示例中,将名称从"testing_json“更改为”testing_json“或Json (没有空格的字符串),它将工作。
import net.sf.json.JSONObject
def jsonEditorOptions = JSONObject.fromObject(/{
disable_edit_json: true,
disable_properties: true,
no_additional_properties: true,
disable_collapse: true,
disable_array_add: true,
disable_array_delete: true,
disable_array_reorder: true,
theme: "bootstrap2",
iconlib:"fontawesome4",
schema: {
"type": "object",
"title": "Name",
"properties": {
"first_name": {
"type": "string",
"propertyOrder" : 1
},
"last_name": {
"type": "string",
"propertyOrder" : 2
},
"full_name": {
"type": "string",
"propertyOrder" : 3,
"template": "{{fname}} {{lname}}",
"watch": {
"fname": "first_name",
"lname": "last_name"
}
}
}
},
startval: {
"first_name" : "John",
"last_name" : "Doe",
"full_name" : "John Doe"
}
}/);https://stackoverflow.com/questions/63902291
复制相似问题