我们正在尝试将当前的sprint作为标记添加到各自sprint的最后提交。为此,我编写了一个powershell脚本。能够获取当前的sprint值作为输出,并能够使用内部版本号标记提交,但无法将该当前的sprint值标记为tag。请找到以下代码并建议< / p>
$uri="$(System.TeamFoundationCollectionUri)$(System.TeamProject)/_apis/work/teamsettings/iterations?timeframe=current&api-version=5.1"
$result = Invoke-RestMethod -Uri $uri -Method Get -Headers @{Authorization="Bearer
$(System.AccessToken)" }
Write-Output $result.value.name //Here its printing current sprint number
Write-Output "success"
Write-Output $result.value.path
Write-Host "##vso[task.setvariable variable=currentSprint]$result.value.name"
Write-Host "##vso[build.addbuildtag]" //Here its adding build number as tag
有任何想法可以将冲刺编号传递给该标签?
答案 0 :(得分:0)
Powershell不会在字符串内扩展value
的{{1}}和name
属性。要解决此问题,请在传递VSO字符串之前将结果分配给变量。
$version