VSTS输入取决于其他输入

时间:2017-08-08 07:52:20

标签: azure-pipelines azure-pipelines-build-task

在VSTS任务中,我有几个输入。我想依赖于另一个输入。我的JSON的相关部分如下:

 "inputs": [
        {
            "name": "Wakeup",
            "type": "boolean",
            "label": "Wakeup",
            "defaultValue": "false",
            "required": false,
            "helpMarkDown": "Makes a wake-up request to the site after deploying.",
            "groupName": "advanced"
        },
        {
            "name": "SiteUrl",
            "type": "string",
            "label": "SiteUrl",
            "defaultValue": "",
            "required": false,
            "helpMarkDown": "The url to the site.",
            "groupName": "advanced"
        }
    ]

如果选择了Wakeup,则需要SiteUrl。但是,如果Wakeup未被选中,则SiteUrl即使对用户也不可编辑(如果可能)。

我一直在关注build task-schema,但无法理解。我想我应该可以使用visibleRule,但不知道如何。

1 个答案:

答案 0 :(得分:0)

试试这段代码:

{
      "name": "SiteUrl",
      "type": "string",
      "label": "SiteUrl",
      "defaultValue": "",
      "required": true,
      "helpMarkDown": "The url to the site.",
      "visibleRule": "Wakeup = true",
      "groupName": "advanced"
    }