"
- Out-File -FilePath $helixLinkFile -Append -InputObject "
$sectionName
"
- Out-File -FilePath $helixLinkFile -Append -InputObject "
"
- foreach($file in $files)
- {
- $url = Append-HelixAccessTokenToUrl $file.Link "{Your-Helix-Access-Token-Here}"
- Out-File -FilePath $helixLinkFile -Append -InputObject "- $($url)
"
- }
- Out-File -FilePath $helixLinkFile -Append -InputObject "
"
- Out-File -FilePath $helixLinkFile -Append -InputObject "
"
- }
-}
-
-function Log-Error
-{
- Param ([string]$message)
-
- # We want to log the error slightly differently depending if we are running in AzDO or not.
- if($env:TF_BUILD)
- {
- Write-Host "##vso[task.logissue type=error;]$message"
- }
- else
- {
- Write-Error "$message" -ErrorAction Continue
- }
-}
-
-function Append-HelixAccessTokenToUrl
-{
- Param ([string]$url, [string]$token)
- if($token)
- {
- if($url.Contains("?"))
- {
- $url = "$($url)&access_token=$($token)"
- }
- else
- {
- $url = "$($url)?access_token=$($token)"
- }
- }
- return $url
-}
-
-#Create output directory
-New-Item $OutputFolder -ItemType Directory
-
-$azureDevOpsRestApiHeaders = @{
- "Accept"="application/json"
- "Authorization"="Basic $([System.Convert]::ToBase64String([System.Text.ASCIIEncoding]::ASCII.GetBytes(":$AccessToken")))"
-}
-
-. "$PSScriptRoot/AzurePipelinesHelperScripts.ps1"
-
-$queryUri = GetQueryTestRunsUri -CollectionUri $CollectionUri -TeamProject $TeamProject -BuildUri $BuildUri -IncludeRunDetails
-Write-Host "queryUri = $queryUri"
-
-$testRuns = Invoke-RestMethodWithRetries $queryUri -Headers $azureDevOpsRestApiHeaders
-$webClient = New-Object System.Net.WebClient
-[System.Collections.Generic.List[string]]$workItems = @()
-
-foreach ($testRun in $testRuns.value)
-{
- $testResults = Invoke-RestMethodWithRetries "$($testRun.url)/results?api-version=5.0" -Headers $azureDevOpsRestApiHeaders
- $isTestRunNameShown = $false
-
- foreach ($testResult in $testResults.value)
- {
- $info = ConvertFrom-Json $testResult.comment
- $helixJobId = $info.HelixJobId
- $helixWorkItemName = $info.HelixWorkItemName
-
- $workItem = "$helixJobId-$helixWorkItemName"
-
- if (-not $workItems.Contains($workItem))
- {
- $workItems.Add($workItem)
- $filesQueryUri = "https://helix.dot.net/api/2019-06-17/jobs/$helixJobId/workitems/$helixWorkItemName/files?access_token=$HelixAccessToken"
- $files = Invoke-RestMethodWithRetries $filesQueryUri
-
- $screenShots = $files | where { $_.Name.EndsWith(".jpg") }
- $dumps = $files | where { $_.Name.EndsWith(".dmp") }
- $visualTreeVerificationFiles = $files | where { $_.Name.EndsWith(".xml") -And (-Not $_.Name.Contains('testResults')) }
- $pgcFiles = $files | where { $_.Name.EndsWith(".pgc") }
- if ($screenShots.Count + $dumps.Count + $visualTreeVerificationFiles.Count + $pgcFiles.Count -gt 0)
- {
- if(-Not $isTestRunNameShown)
- {
- Out-File -FilePath $helixLinkFile -Append -InputObject "