如何从另一个构建的构建步骤中暂停TeamCity构建

时间:2019-02-12 08:28:23

标签: build configuration teamcity

在TeamCity中,我有2个具有不同触发器的相关构建。

第一个构建正在执行时,我想暂停第二个构建。

所以我的想法是在构建1中有一个构建步骤来暂停构建2。然后在另一个构建步骤中再次激活它。

在TeamCity中这可能吗?还是应该使用其他方法?

1 个答案:

答案 0 :(得分:0)

我通过添加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
相关问题