在 TFS 2015 中,对于失败的 VNext 构建,构建失败的步骤(构建任务)是否存储在数据库中的任何位置

In TFS 2015, for failed VNext builds, are the steps (build tasks) the build failed on stored in DB anywhere

我知道如果我点击构建 link 查看摘要,它会显示所有步骤,但我找不到使用 [=14 在任何地方构建失败的实际步骤(构建任务) =] 或查看 TFS 数据库。

TFS 2015 是否将其存储在可访问的任何位置?

您可以使用 REST API (Timeline - Get)

从构建 Timeline 中检索失败的步骤

只需在 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