Вы можете получить неудачные шаги из сборки Timeline
с помощью REST API ( Временная шкала - Получить )
Просто попробуйте ниже пример PowerShell, чтобы получить неудачные шаги (задача сборки) изсборка:
Param(
[string]$collectionurl = "http://ictfs2015:8080/tfs/DefaultCollection",
[string]$projectName = "ProjectName",
[string]$BuildId = "44",
[string]$user = "username",
[string]$token = "password"
)
# Base64-encodes the Personal Access Token (PAT) appropriately
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $user,$token)))
$uri = "$($collectionurl)/$($projectName)/_apis/build/builds/$BuildId/timeline?api-version=2.0"
$response = Invoke-RestMethod -Uri $uri -Method Get -Headers @{Authorization=("Basic {0}" -f $base64AuthInfo)}
$steps = $response.records | where {$_.result -eq 'failed' -and $_.type -eq 'Task'} # Filter the failed steps
$failedsteps = @()
foreach($step in $steps){
$customObject = new-object PSObject -property @{
"StepId" = $step.id
"type" = $step.type
"TaskName" = $step.name
"startTime" = $step.startTime
"finishTime" = $step.finishTime
"state" = $step.state
"result" = $step.result
"changeId" = $step.changeId
"workerName" = $step.workerName
}
$failedsteps += $customObject
}
$failedsteps | Select `
StepId,
type,
TaskName,
startTime,
finishTime,
state,
result,
changeId,
workerName #|export-csv -Path C:\FailedBuildSteps.csv -NoTypeInformation