Jenkins从Groovy脚本扩展了选择参数插件检索值

时间:2017-03-01 02:35:52

标签: jenkins groovy jenkins-plugins

我正在使用扩展选择参数Jenkins插件。使用插件网页中提供的Groovy脚本,对其进行了一些更改,并且当前具有:

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: true,
        disable_array_delete: true,
        disable_array_reorder: true,
        theme: "bootstrap2",
        iconlib:"fontawesome4",
       "schema":{
             "title": "Environments",
             "type": "array",
             "format":"tabs",
             "items": {
                 "title": "Environment",
                 "headerTemplate": "{{self.name}}",
                 "type": "object",
                 "properties": {
                    "name" : {
                         "title": "Environment",
                         "type": "string",
                         "readOnly": "true",
                         "propertyOrder" : 1

                     },
                     "Properties": {
                         "type": "array",
                         "format": "table",
                         "propertyOrder" : 2,
                         "items": {
                             "type": "object",
                              "properties": {
                                  "URL" : {
                                      "type": "string",
                                      "readOnly": "true",
                                      "propertyOrder" : 1
                                  },
                                  "User" : {
                                      "type": "string",
                                      "readOnly": "true",
                                      "propertyOrder" : 2
                                  },
                                  "Password" : {
                                      "type": "string",
                                      "propertyOrder" : 3
                                  }
                              }
                         }
                     }
                 }
             }
         },
       startval: [
  {
    [
      {
        "name": "DEV",
        "Properties": [
          {
            "URL": "host:port1",
            "User": "user1",
                        "Password":""
          }
        ]
      },
      {
        "name": "TST",
        "Properties": [
          {
            "URL": "host:port2,
            "User": "user2",
                        "Password":""
          }
        ]
      }
    ]
  }
]
}

}/);

return jsonEditorOptions;

我想知道:

1)在构建时,根据用户的选择/输入,让我们说:DEV。那么与DEV相关的值将是: - URL:host:port1 - 用户:user1 - 密码:123456

如何获取这些值(DEV,host:port1,user1,123456)并将其作为构建步骤中的参数传递?

2)有没有办法在用户输入字段时屏蔽密码字段的值?

0 个答案:

没有答案