gpt4 book ai didi

parameters - TeamCity 构建状态参数

转载 作者:行者123 更新时间:2023-12-04 08:31:17 26 4
gpt4 key购买 nike

我可能忽略了 TeamCity 中的内置参数。我正在尝试将构建状态作为参数发送到控制台应用程序。控制台应用程序是一个构建步骤,即使前面的步骤失败,它也需要运行。如果前面的步骤失败,它将做一件事,如果前面的步骤成功,它将做另一件事。

我已将控制台应用程序设置为采用构建状态参数,但我没有找到要使用的内置构建状态参数(成功/失败)。我错过了一些简单的事情吗?如何访问构建状态?

谢谢!

最佳答案

我已经尝试了 link in the answer by user2097151 中的代码,但一开始并没有奏效。所以我修改了它。我将在这里发布修改:

[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12;

$buildId = "%teamcity.build.id%"
function TeamCityBuildStatus
{
param
(
[string] $ServerUrl,
[string] $UserName,
[string] $Password,
[string] $BuildId
)

$client = New-Object System.Net.WebClient

$pair = "$($UserName):$Password"
$encodedCreds = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($pair))
$client.Headers.Add("Authorization", "Basic $encodedCreds")

$url = "https://$ServerUrl/httpAuth/app/rest/builds/$buildId/status"

$status = $client.DownloadString($url)

return $status -eq "SUCCESS"
}

$status = TeamCityBuildStatus -ServerUrl $teamcityUrl -UserName $teamcityUser -Password $teamcityPass -BuildId $buildId

该解决方案不会在这是最后一个版本中进行中继。

我在 this 中找到的发送凭据的方式线。
我在 this 中找到了 TLS 版本更改线。

希望它可以帮助某人。

关于parameters - TeamCity 构建状态参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25068829/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com