我正在为发布任务开发一个自定义 vsts 扩展,它有一个选择列表,其中包含从 REST 端点数据源(我的存储帐户)填充的值。我正在关注这个打击链接作为参考。 https://docs.microsoft.com/en-us/vsts/extend/develop/service-endpoints?view=vsts
我已经上传了我的扩展,但选择列表没有填充任务中的值。
以下是我所做的配置。vss-extension.json:
{
“manifestVersion”: 1,
“id”: “build-release-task”,
“name”: “My Custom release task”,
“version”: “0.0.1”,
“publisher”: “custext”,
“public”: false,
“targets”: [
{
“id”: “Microsoft.VisualStudio.Services”
}
],
“description”: “A picklist which has values populated from the REST
endpoint data source. Includes one build/release task.”,
“categories”: [
“Build and release”
],
“icons”: {
“default”: “images/extension-icon.png”
},
“files”: [
{
“path”: “buildAndReleaseTask”
}
],
“contributions”: [
{
“id”: “service-endpoint”,
“description”: “Service Endpoint type for custom Storage connection”,
“type”: “ms.vss-endpoint.service-endpoint-type”,
“targets”: [ “ms.vss-endpoint.endpoint-types” ],
“properties”: {
“name”: “custom”,
“displayName”: “Custom server connection”,
“url”: {
“displayName”: “Server Url”,
“helpText”: “storage end point url.”
},
“dataSources”: [
{
“name”: “Storage Account”,
“endpointUrl”: “{{endpoint.url}}test/?restype=container&comp=list”,
“resultSelector”: “xpath://EnumerationResults/Blobs/Blob/Name”
}
],
]
}
],
“helpMarkDown”: “Learn More”
}
},
{
“id”: “custom-build-release-task”,
“type”: “ms.vss-distributed-task.task”,
“description”: “Task with a dynamic property getting data from an
endpoint REST data source”,
“targets”: [
“ms.vss-distributed-task.tasks”
],
“properties”: {
“name”: “buildAndReleaseTask”
}
}
]
}
任务.json:
{
“id”: “325958a0-63b7-11e6-88a5-f7c7f66e6264”,
“name”: “dropdownlist”,
“friendlyName”: “Drop down list”,
“description”: “Lists the db files”,
“helpMarkDown”: “Custom release task.Drop down list”,
“category”: “Utility”,
“visibility”: [
“Release”
],
“author”: “satyam”,
“version”: {
“Major”: 0,
“Minor”: 1,
“Patch”: 0
},
“instanceNameFormat”: “dropdownlist $(message)”,
“groups”: [
{
“name”: “advanced”,
“displayName”: “Advanced”,
“isExpanded”: false
}
],
“inputs”: [
{
“name”: “CustomService”,
“type”: “connectedService:custom”,
“label”: “Storage end point”,
“defaultValue”: “”,
“required”: true,
“helpMarkDown”: “Select the storage account to use. If needed,
click on ‘manage’, and add a new Service Endpoint of type
‘Custom server connection'”
},
{
“name”: “Scripts”,
“type”: “pickList”,
“label”: “saasscripts”,
“required”: true,
“helpMarkDown”: “Select the name of the saas script.”,
“properties”: {
“EditableOptions”: “True”
}
}
],
“dataSourceBindings”: [
{
“target”: “Scripts”,
“endpointId”: “$(CustomService)”,
“dataSourceName”: “Storage Account”
}
],
“outputVariables”: [
{
“name”: “dbfile”,
“description”: “Application URL of the selected App
Service.”
}
],
“execution”: {
“Node”: {
“target”: “powershell.js”
}
}
}
endpointUrl:我在数据源(vss-extension.json)中的 endpointUrl 中尝试了以下方法
- {{endpoint.url}}test/?restype=container&comp=list 2. https://mycontainername.blob.core.windows.net/test/restype=container&comp=list
选择列表未填充 blob 内容。我猜上述问题中的问题可能无法解析 azure storage blob list 响应类型。其余的 api 响应在 XML 文件的开头包含 BOM (" ),这可能是解析的原因。一世”
是否有任何方法或解决方法可以更改 azure blob rest api 响应以排除 BOM (" ) 或将响应更改为 JSON 格式。