我们正在使用Team Foundation Server2017。经过大量发布之后,我仍然遇到了问题。
在发行过程中,我收到一条消息,我将直接写到发行说明摘要中。我在Marketstore中检查了一项这样的活动,但没有找到。
我无法搜索正确的活动吗,还是有另一种方法来更新此活动?
答案 0 :(得分:2)
当前,您只能使用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}参数。在下面查看我的屏幕截图:
我已经经过测试,可以成功更新发行说明。