如何显示“区域路径"在 VSTS 构建任务输入 PickList 中? [英] How to display "Area path" in VSTS build task input PickList?

查看:16
本文介绍了如何显示“区域路径"在 VSTS 构建任务输入 PickList 中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在 VSTS 构建任务输入选择列表中显示区域路径",以便我可以从构建任务中检索用户选择的区域路径"值并将其设置在构建任务生成的工作项中.现有的 VSTS API 是否可以做到这一点?如果是这样怎么做?

I need to display the the "Area path" in a VSTS Build task input PickList, so that I can retrieve the user selected "Area path" value from my build task and set it in a work item generated by the build task. Is this possible with existing VSTS API? If so how to do this?

我认为这是在实用程序部分的复制文件任务中完成的.

I think this is done in Copy Files task in Utilty section.

提前致谢.

推荐答案

是的.您可以在 task.josn 文件中添加以下部分来实现此目的:

Yes, it is. You can add following section in task.josn file to achieve this:

  "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"
        }
    ],

你会得到这样的构建任务:

And you will get the build task like this:

然而,由于 分类节点api,子区域层级越多,输入越多.

However, due to data structure in the response of classification nodes api, you have to add more inputs when there are more level of child areas.

这篇关于如何显示“区域路径"在 VSTS 构建任务输入 PickList 中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆