【问题标题】:TFS 2017 Change Release summary description during build构建期间的 TFS 2017 更改版本摘要说明
【发布时间】:2018-12-28 08:49:02
【问题描述】:

我们使用的是 Team Foundation Server 2017。经过大量发布定义后,我遇到了一个问题。

在发布期间,我收到一条消息,我会直接将其写入发布说明摘要。我在 Marketstore 中检查了此类活动,但没有找到。

我无法搜索正确的活动还是有其他方法可以更新?

【问题讨论】:

  • 我现在不能。我将在 2 周后检查
  • 不是喷气机。我正在享受我的空闲时间

标签: tfs release azure-pipelines-release-pipeline


【解决方案1】:

目前,您只能使用Logging command 更新版本名称,这需要代理版本 2.132+。因此,更新发布描述的唯一方法是在发布定义中添加一个 powershell 脚本。脚本如下:

param (
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[string] $token
)

## Construct a basic auth head using PAT
function BasicAuthHeader()
{
param([string]$authtoken)

$ba = (":{0}" -f $authtoken)
$ba = [System.Text.Encoding]::UTF8.GetBytes($ba)
$ba = [System.Convert]::ToBase64String($ba)
$h = @{Authorization=("Basic{0}" -f $ba);ContentType="application/json"}
return $h
}

$getReleaseUri = "http://TFS2017:8080/tfs/DefaultCollection/TeamProject/_apis/release/releases/$($env:RELEASE_RELEASEID)?api-version=3.2-preview"


$h = BasicAuthHeader $token

$release = Invoke-RestMethod -Uri $getReleaseUri -Headers $h -Method Get

# Update an existing variable named d1 to its new value d5
$release.description = "this is a test";

####****************** update the modified object **************************
$release2 = $release | ConvertTo-Json -Depth 100
$release2 = [Text.Encoding]::UTF8.GetBytes($release2)

$updateReleaseUri = "http://TFS2017:8080/tfs/DefaultCollection/TeamProject/_apis/release/releases/$($env:Release_ReleaseId)?api-version=3.2-preview"
$content2 = Invoke-RestMethod -Uri $updateReleaseUri -Method Put -Headers $h -ContentType “application/json” -Body $release2 -Verbose -Debug

write-host "=========================================================="

并带有参数 -token {PAT}。检查下面的屏幕截图:

我这边测试过,可以成功更新发布说明。

【讨论】:

  • 非常感谢。我已经测试过了。权限有些问题,但现在一切正常。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2016-02-10
  • 1970-01-01
  • 2012-03-04
  • 2019-09-16
  • 2023-04-07
  • 2018-11-21
  • 2018-09-14
相关资源
最近更新 更多