我想验证是否执行了发布管道,或者没有使用PowerShell,而不登录到Azure DevOps项目。怎么测试这个?此外,是否可以像使用PowerShell获得成功或失败一样获得发行版的输出?
发布于 2021-01-07 03:41:57
我想验证是否执行了发布管道,或者没有使用PowerShell,而不登录到Azure DevOps项目。
如果您想验证是否使用PowerShell执行了发布管道,下面的脚本可以实现这一点。
$url = "https://vsrm.dev.azure.com/{organization}/{project}/_apis/release/definitions?api-version=6.0"
$connectionToken="PAT Here" #input your PAT
$base64AuthInfo= [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes(":$($connectionToken)"))
$pipelines = Invoke-RestMethod -Uri $url -Headers @{authorization = "Basic $base64AuthInfo"} -Method Get
Write-Host "Pipeline = $($pipelines | ConvertTo-Json -Depth 100)" #list all release pieplines $new_url = https://vsrm.dev.azure.com/{organization}/{project}/_apis/release/releases?definitionId={definitionId}&api-version=6.0
$releases = Invoke-RestMethod -Uri $new_url -Headers @{authorization = "Basic $base64AuthInfo"} -Method Get
Write-Host "releases = $($releases | ConvertTo-Json -Depth 100)" 发布于 2021-01-06 13:31:54
您可以使用az命令:
此外,您可以使用--output参数来获得json格式的结果,然后您将获得更详细的信息。
https://stackoverflow.com/questions/65594792
复制相似问题