RestAPI - 通过具有多个工件的 PowerShell 创建发布

问题描述 投票:0回答:0

我设法通过 PowerShell 创建了一个新版本,该版本有 2 个工件,我想每次触发一个不同的工件,所以我通过传递正确的工件名称和相应的内部版本号来尝试发布,在创建发布后我看到了始终是第二个工件(定义为主要工件)的内部版本号。 (我知道我传递的是正确的名称,因为如果我在未定义工件的情况下尝试创建一个版本,我会得到一个错误)

$body = '{"definitionId": ' + $releaseDefId + ', "description": "' + $description + '", "artifacts": [{"alias": "' + "_$Buildname" + '", "instanceReference": {"id": "' + $($Lastbuild.Id) + '", "name": "' + $Buildname + '", "sourceBranch": "' + $SourceBranch + '"}}]}'

$releaseResponse = Invoke-RestMethod -Method Post -UseDefaultCredentials -ContentType "application/json" -Uri $releaseUri -Body $body

_$Buildname
每次都等于另一个神器。
$Lastbuild.Id
取自上次构建

开始发布后附上第二个工件的内部版本号

另外,当手动创建版本时,列表中有 2 个工件,但我无法选择,但再次选择了主要工件

powershell api azure-pipelines-release-pipeline
© www.soinside.com 2019 - 2024. All rights reserved.