我需要在VSTS構建任務輸入PickList中顯示「區域路徑」,以便我可以從構建任務中檢索用戶選擇的「區域路徑」值,並將其設置在構建任務生成的工作項中。現有的VSTS API有可能嗎?如果是的話如何做到這一點?如何在VSTS構建任務輸入PickList中顯示「區域路徑」?
在此先感謝。
我需要在VSTS構建任務輸入PickList中顯示「區域路徑」,以便我可以從構建任務中檢索用戶選擇的「區域路徑」值,並將其設置在構建任務生成的工作項中。現有的VSTS API有可能嗎?如果是的話如何做到這一點?如何在VSTS構建任務輸入PickList中顯示「區域路徑」?
在此先感謝。
是的。您可以在task.josn文件中添加以下部分來實現這一點:
"inputs": [
{
"name": "rootArea",
"type": "pickList",
"label": "rootArea",
"defaultValue": "",
"required": false,
"helpMarkDown": "Select the root area.",
"properties": {
"DisableManageLink": "True"
}
},
{
"name": "childArea",
"type": "pickList",
"label": "childArea",
"defaultValue": "",
"required": false,
"helpMarkDown": "Select the child area.",
"properties": {
"DisableManageLink": "True"
}
}
],
"sourceDefinitions": [
{
"target": "rootArea",
"endpoint": "/$(system.teamProject)/_apis/wit/classificationNodes/areas?$depth=2&api-version=1.0",
"selector": "jsonpath:$.name",
"keySelector": "jsonpath:$.name",
"authKey": "tfs:teamfoundation"
},
{
"target": "childArea",
"endpoint": "/$(system.teamProject)/_apis/wit/classificationNodes/areas?$depth=2&api-version=1.0",
"selector": "jsonpath:$.children[*].name",
"keySelector": "jsonpath:$.children[*].name",
"authKey": "tfs:teamfoundation"
}
],
然而,由於數據結構的classification nodes api響應,你當有更多的兒童區域時,必須增加更多的投入。
您可以定義sourceDefinitions以調用服務(例如REST API)以獲取必要的數據並將數據綁定到dataSourceBindings中的相應選取列表。但是沒有找到獲得當前團隊項目URL的方式?你能讓用戶指定團隊項目的URL嗎? –
相關鏈接:https://github.com/Microsoft/vsts-tasks/issues/667 https://github.com/Microsoft/vsts-tasks/blob/master/Tasks/AzureAppServiceManage/task.json –
@ starain- MSFT:我不能讓用戶輸入項目名稱,也無法使用VSTS憑據指定單獨的終端來獲取此數據。 (例如,您發送的示例鏈接) 謝謝。 – Bandara