门控签入成功后的构建步骤

时间:2017-07-20 06:50:53

标签: azure-pipelines

目前我们正在将XAML-Build迁移到新的TFS Build-System。我们有TFS内部部署。

关于门禁签到的问题:门控签到成功后,我们创建了一个代码审查工作项。这不是XAML Builds中的问题。我们写了一个活动。此活动在实际办理登机手续后执行。

问题是:在门控签入成功后,有没有办法在新的Build-System(vnext)中创建构建步骤?我们需要创建构建的Changeset-Id。

1 个答案:

答案 0 :(得分:0)

首先,您可以在签入更改时关联工作项,然后在验证构建后,更改集将与相应的工作项相关联。

其次,您可以使用update work item REST API

将变更集与工作项相关联

例如:

PATCH https://[account].visualstudio.com/DefaultCollection/_apis/wit/workitems/[work item id]?api-version=1.0

ContentType:application/json-patch+json

体:

[
  {
    "op": "add",
    "path": "/relations/-",
    "value": {
      "rel": "ArtifactLink",
      "url": "vstfs:///VersionControl/Changeset/[changeset ID]",
      "attributes": {
        "comment": "apitest",
         "name": "Fixed in Changeset"
      }
    }
  }
]

您可以使用Build.SourceVersion获取ChangeSet。 Build variables

通过PowerShell任务获取chageset的简单示例:

参数:-v $(Build.SourceVersion)

脚本:

param(
[string]$v
)
Write-Host $v

关于在构建期间调用REST API的博客:Calling VSTS APIs with PowerShell

相关问题