我有一个 Azure DevOps YAML 管道,其中的
deploy
作业失败了:
我点击的每个作业都没有显示失败。在 Azure DevOps UI 中的哪里可以找到导致管道失败的操作?
供参考,我的管道 YAML 如下:
jobs:
- deployment:
environment:
name: XXX-XXX-BLD
resourceType: virtualMachine
strategy:
rolling:
maxParallel: 5 #for percentages, mention as x%
deploy:
steps:
- powershell: |
# Use the Windows certificate store for Git's SSL certificates for both
# agents (build and deploy).
& C:\agents\build\externals\git\cmd\git.exe config --global http.sslBackend schannel
& C:\agents\deploy\externals\git\cmd\git.exe config --global http.sslBackend schannel
- powershell: |
#Requires -RunAsAdministrator
& choco upgrade buildstation --pre --no-progress
您可以使用 Timeline - Get REST API 获取本次运行的详细状态。
PowerShell 脚本示例:
$organization = "orgname"
$project = "projectname"
$buildId = ""
$PAT = ""
$PATGetBytes = [System.Text.Encoding]::ASCII.GetBytes(":$PAT")
$Authentication = [System.Convert]::ToBase64String($PATGetBytes)
$Headers = @{Authorization = ("Basic {0}" -f $Authentication) }
# Define the URL for the Timeline API
$url = "https://dev.azure.com/$organization/$project/_apis/build/builds/$buildId/timeline/?api-version=7.1-preview.2"
# Make the API request
$response = Invoke-RestMethod -Uri $url -Method Get -ContentType "application/json" -Headers $Headers
# Parse the response to get the records
$status = $response.records
# Output
$status | ForEach-Object {
Write-Output ("Result : " + $_.result + ", State: " + $_.state + ", Type: " + $_.type + ", Name : " + $_.name )
}