带有验证链接的VSTS服务端点

时间:2018-01-16 14:07:09

标签: azure-devops azure-pipelines-release-pipeline azure-pipelines-build-task

您好我创建了一个服务端点,读取此VSTS Service EndPoint Tutorial并成功创建。 当我看到jenkins端点时,它有一个验证链接来验证端点enter image description here 我谷歌太多的样本,但没有相关的信息。任何人都可以帮助实现这一目标。

1 个答案:

答案 0 :(得分:2)

您需要在vss-extension.json文件中添加带有TestConnection名称的数据源,例如:

{
      "id": "service-endpoint",
      "description": "Service Endpoint type for Fabrikam connections",
      "type": "ms.vss-endpoint.service-endpoint-type",
      "targets": [ "ms.vss-endpoint.endpoint-types" ],
      "properties": {
        "name": "fabrikam",
        "displayName": "Fabrikam server connection",
        "url": {
          "displayName": "Server Url",
          "helpText": "Url for the Fabrikam server to connect to."
        },
        "dataSources": [
          { 
              "name": "TestConnection",
              "endpointUrl": "{{endpoint.url}}api/projects/index",
              "resultSelector": "jsonpath:$[*].nm" 
          },
          {
            "name": "Fabrikam Projects",
            "endpointUrl": "{{endpoint.url}}api/projects/index",
            "resultSelector": "jsonpath:$[*].nm"
          }

        ],
        "authenticationSchemes": [
          {
            "type": "ms.vss-endpoint.endpoint-auth-scheme-token"
          },
          {
            "type": "ms.vss-endpoint.endpoint-auth-scheme-basic",
            "inputDescriptors": [
              {
                "id": "username",
                "name": "Username",
                "description": "Username",
                "inputMode": "textbox",
                "validation": {
                  "isRequired": false,
                  "dataType": "string"
                }
              },
              {
                "id": "password",
                "name": "Password",
                "description": "Password",
                "inputMode": "passwordbox",
                "isConfidential": true,
                "validation": {
                  "isRequired": false,
                  "dataType": "string"
                }
              }
            ]
          }

        ],
        "helpMarkDown": "<a href=\"url-to-documentation\" target=\"_blank\"><b>Learn More</b></a>"
      }
    }