在TeamCity中,我有2个具有不同触发器的相关构建。
当第一个构建正在执行时,我想暂停第二个构建。
所以我的想法是在构建1中有一个构建步骤来暂停构建2. …
我通过添加PowerShell构建步骤向TeamCity API发送Web请求来解决此问题。
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(($($Username):$($Password)"))) $headers = @{ Authorization = "Basic $base64AuthInfo" } Invoke-RestMethod -Method Put -Uri "http://rzaplp4:8088/app/rest/buildTypes/$($BuildId)/paused" -Body "true" -ContentType "text/plain" -Headers $headers > $null