Skip to content

Commit 2366427

Browse files
miniksaDHowett
authored andcommitted
Move PGO Helix pools (#11028)
Moves PGO runs to supported Helix pools. We need to match Microsoft-UI-XAML on which Helix pools we used for each type of activities. ## PR Checklist * [x] Closes #10850 * [x] I work here * [x] If it builds, it sits. ## Validation Steps Performed * [x] Run PGO build against this branch (cherry picked from commit 817f598)
1 parent 3fad41c commit 2366427

File tree

7 files changed

+62
-15
lines changed

7 files changed

+62
-15
lines changed

build/Helix/OutputTestResults.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Write-Host "Checking test results..."
2121
$queryUri = GetQueryTestRunsUri -CollectionUri $CollectionUri -TeamProject $TeamProject -BuildUri $BuildUri -IncludeRunDetails
2222
Write-Host "queryUri = $queryUri"
2323

24-
$testRuns = Invoke-RestMethod -Uri $queryUri -Method Get -Headers $azureDevOpsRestApiHeaders
24+
$testRuns = Invoke-RestMethodWithRetries $queryUri -Headers $azureDevOpsRestApiHeaders
2525
[System.Collections.Generic.List[string]]$failingTests = @()
2626
[System.Collections.Generic.List[string]]$unreliableTests = @()
2727
[System.Collections.Generic.List[string]]$unexpectedResultTest = @()
@@ -50,7 +50,7 @@ foreach ($testRun in ($testRuns.value | Sort-Object -Property "completedDate" -D
5050
$totalTestsExecutedCount += $testRun.totalTests
5151

5252
$testRunResultsUri = "$($testRun.url)/results?api-version=5.0"
53-
$testResults = Invoke-RestMethod -Uri "$($testRun.url)/results?api-version=5.0" -Method Get -Headers $azureDevOpsRestApiHeaders
53+
$testResults = Invoke-RestMethodWithRetries "$($testRun.url)/results?api-version=5.0" -Headers $azureDevOpsRestApiHeaders
5454

5555
foreach ($testResult in $testResults.value)
5656
{

build/Helix/ProcessHelixFiles.ps1

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,31 @@ function Generate-File-Links
2020
Out-File -FilePath $helixLinkFile -Append -InputObject "<ul>"
2121
foreach($file in $files)
2222
{
23-
Out-File -FilePath $helixLinkFile -Append -InputObject "<li><a href=$($file.Link)>$($file.Name)</a></li>"
23+
$url = Append-HelixAccessTokenToUrl $file.Link "{Your-Helix-Access-Token-Here}"
24+
Out-File -FilePath $helixLinkFile -Append -InputObject "<li>$($url)</li>"
2425
}
2526
Out-File -FilePath $helixLinkFile -Append -InputObject "</ul>"
2627
Out-File -FilePath $helixLinkFile -Append -InputObject "</div>"
2728
}
2829
}
2930

31+
function Append-HelixAccessTokenToUrl
32+
{
33+
Param ([string]$url, [string]$token)
34+
if($token)
35+
{
36+
if($url.Contains("?"))
37+
{
38+
$url = "$($url)&access_token=$($token)"
39+
}
40+
else
41+
{
42+
$url = "$($url)?access_token=$($token)"
43+
}
44+
}
45+
return $url
46+
}
47+
3048
#Create output directory
3149
New-Item $OutputFolder -ItemType Directory
3250

@@ -63,7 +81,8 @@ foreach ($testRun in $testRuns.value)
6381
if (-not $workItems.Contains($workItem))
6482
{
6583
$workItems.Add($workItem)
66-
$filesQueryUri = "https://helix.dot.net/api/2019-06-17/jobs/$helixJobId/workitems/$helixWorkItemName/files$accessTokenParam"
84+
$filesQueryUri = "https://helix.dot.net/api/2019-06-17/jobs/$helixJobId/workitems/$helixWorkItemName/files"
85+
$filesQueryUri = Append-HelixAccessTokenToUrl $filesQueryUri $helixAccessToken
6786
$files = Invoke-RestMethodWithRetries $filesQueryUri
6887

6988
$screenShots = $files | where { $_.Name.EndsWith(".jpg") }
@@ -102,6 +121,7 @@ foreach ($testRun in $testRuns.value)
102121

103122
Write-Host "Downloading $link to $destination"
104123

124+
$link = Append-HelixAccessTokenToUrl $link $HelixAccessToken
105125
Download-FileWithRetries $link $destination
106126
}
107127
}

build/Helix/UpdateUnreliableTests.ps1

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Write-Host "queryUri = $queryUri"
2323
# To account for unreliable tests, we'll iterate through all of the tests associated with this build, check to see any tests that were unreliable
2424
# (denoted by being marked as "skipped"), and if so, we'll instead mark those tests with a warning and enumerate all of the attempted runs
2525
# with their pass/fail states as well as any relevant error messages for failed attempts.
26-
$testRuns = Invoke-RestMethod -Uri $queryUri -Method Get -Headers $azureDevOpsRestApiHeaders
26+
$testRuns = Invoke-RestMethodWithRetries $queryUri -Headers $azureDevOpsRestApiHeaders
2727

2828
$timesSeenByRunName = @{}
2929

@@ -32,10 +32,10 @@ foreach ($testRun in $testRuns.value)
3232
$testRunResultsUri = "$($testRun.url)/results?api-version=5.0"
3333

3434
Write-Host "Marking test run `"$($testRun.name)`" as in progress so we can change its results to account for unreliable tests."
35-
Invoke-RestMethod -Uri "$($testRun.url)?api-version=5.0" -Method Patch -Body (ConvertTo-Json @{ "state" = "InProgress" }) -Headers $azureDevOpsRestApiHeaders -ContentType "application/json" | Out-Null
35+
Invoke-RestMethod "$($testRun.url)?api-version=5.0" -Method Patch -Body (ConvertTo-Json @{ "state" = "InProgress" }) -Headers $azureDevOpsRestApiHeaders -ContentType "application/json" | Out-Null
3636

3737
Write-Host "Retrieving test results..."
38-
$testResults = Invoke-RestMethod -Uri $testRunResultsUri -Method Get -Headers $azureDevOpsRestApiHeaders
38+
$testResults = Invoke-RestMethodWithRetries $testRunResultsUri -Headers $azureDevOpsRestApiHeaders
3939

4040
foreach ($testResult in $testResults.value)
4141
{
@@ -54,7 +54,8 @@ foreach ($testRun in $testRuns.value)
5454
Write-Host " Test $($testResult.testCaseTitle) was detected as unreliable. Updating..."
5555

5656
# The errorMessage field contains a link to the JSON-encoded rerun result data.
57-
$rerunResults = ConvertFrom-Json (New-Object System.Net.WebClient).DownloadString($testResult.errorMessage)
57+
$resultsJson = Download-StringWithRetries "Error results" $testResult.errorMessage
58+
$rerunResults = ConvertFrom-Json $resultsJson
5859
[System.Collections.Generic.List[System.Collections.Hashtable]]$rerunDataList = @()
5960
$attemptCount = 0
6061
$passCount = 0

build/pipelines/templates/build-console-pgo.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ parameters:
33
platform: ''
44
additionalBuildArguments: ''
55
minimumExpectedTestsExecutedCount: 1 # Sanity check for minimum expected tests to be reported
6-
rerunPassesRequiredToAvoidFailure: 0
6+
rerunPassesRequiredToAvoidFailure: 5
77

88
jobs:
99
- job: Build${{ parameters.platform }}${{ parameters.configuration }}

build/pipelines/templates/helix-processtestresults-job.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ jobs:
2222
condition: succeededOrFailed()
2323
env:
2424
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
25+
HelixAccessToken: $(HelixApiAccessToken)
2526
inputs:
2627
targetType: filePath
2728
filePath: build\Helix\UpdateUnreliableTests.ps1
@@ -32,6 +33,7 @@ jobs:
3233
condition: succeededOrFailed()
3334
env:
3435
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
36+
HelixAccessToken: $(HelixApiAccessToken)
3537
inputs:
3638
targetType: filePath
3739
filePath: build\Helix\OutputTestResults.ps1

build/pipelines/templates/helix-runtests-job.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ parameters:
1515
# if 'useBuildOutputFromBuildId' is set, we will default to using a build from this pipeline:
1616
useBuildOutputFromPipeline: $(System.DefinitionId)
1717
openHelixTargetQueues: 'windows.10.amd64.client19h1.open.xaml'
18+
closedHelixTargetQueues: 'windows.10.amd64.client19h1.xaml'
1819

1920
jobs:
2021
- job: ${{ parameters.name }}
@@ -29,11 +30,11 @@ jobs:
2930
buildConfiguration: ${{ parameters.configuration }}
3031
buildPlatform: ${{ parameters.platform }}
3132
openHelixTargetQueues: ${{ parameters.openHelixTargetQueues }}
33+
closedHelixTargetQueues: ${{ parameters.closedHelixTargetQueues }}
3234
artifactsDir: $(Build.SourcesDirectory)\Artifacts
3335
taefPath: $(Build.SourcesDirectory)\build\Helix\packages\Microsoft.Taef.10.60.210621002\build\Binaries\$(buildPlatform)
3436
helixCommonArgs: '/binaryLogger:$(Build.SourcesDirectory)/${{parameters.name}}.$(buildPlatform).$(buildConfiguration).binlog /p:HelixBuild=$(Build.BuildId).$(buildPlatform).$(buildConfiguration) /p:Platform=$(buildPlatform) /p:Configuration=$(buildConfiguration) /p:HelixType=${{parameters.helixType}} /p:TestSuite=${{parameters.testSuite}} /p:ProjFilesPath=$(Build.ArtifactStagingDirectory) /p:rerunPassesRequiredToAvoidFailure=${{parameters.rerunPassesRequiredToAvoidFailure}}'
3537

36-
3738
steps:
3839
- task: CmdLine@1
3940
displayName: 'Display build machine environment variables'
@@ -140,10 +141,23 @@ jobs:
140141

141142
- task: DotNetCoreCLI@2
142143
displayName: 'Run tests in Helix (open queues)'
144+
condition: and(succeeded(),eq(variables['System.CollectionUri'],'https://dev.azure.com/ms/'))
143145
env:
144146
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
145147
inputs:
146148
command: custom
147149
projects: build\Helix\RunTestsInHelix.proj
148150
custom: msbuild
149151
arguments: '$(helixCommonArgs) /p:IsExternal=true /p:Creator=Terminal /p:HelixTargetQueues=$(openHelixTargetQueues)'
152+
153+
- task: DotNetCoreCLI@2
154+
displayName: 'Run tests in Helix (closed queues)'
155+
condition: and(succeeded(),ne(variables['System.CollectionUri'],'https://dev.azure.com/ms/'))
156+
env:
157+
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
158+
HelixAccessToken: $(HelixApiAccessToken)
159+
inputs:
160+
command: custom
161+
projects: build\Helix\RunTestsInHelix.proj
162+
custom: msbuild
163+
arguments: '$(helixCommonArgs) /p:HelixTargetQueues=$(closedHelixTargetQueues)'

build/pipelines/templates/pgo-build-and-publish-nuget-job.yml

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,15 @@ jobs:
2020
inputs:
2121
artifactName: ${{ parameters.pgoArtifact }}
2222
downloadPath: $(artifactsPath)
23-
23+
24+
- task: NuGetAuthenticate@0
25+
inputs:
26+
nuGetServiceConnections: 'Terminal Public Artifact Feed'
27+
2428
- task: NuGetToolInstaller@0
25-
displayName: 'Use NuGet 5.2.0'
29+
displayName: 'Use NuGet 5.8.0'
2630
inputs:
27-
versionSpec: 5.2.0
31+
versionSpec: 5.8.0
2832

2933
- task: CopyFiles@2
3034
displayName: 'Copy pgd files to NuGet build directory'
@@ -58,5 +62,11 @@ jobs:
5862
displayName: 'NuGet push'
5963
inputs:
6064
command: push
61-
publishVstsFeed: Terminal/TerminalDependencies
62-
packagesToPush: $(Build.ArtifactStagingDirectory)/*.nupkg
65+
nuGetFeedType: external
66+
packagesToPush: $(Build.ArtifactStagingDirectory)/*.nupkg
67+
# The actual URL and PAT for this feed is configured at
68+
# https://microsoft.visualstudio.com/Dart/_settings/adminservices
69+
# This is the name of that connection
70+
publishFeedCredentials: 'Terminal Public Artifact Feed'
71+
feedsToUse: config
72+
nugetConfigPath: '$(Build.SourcesDirectory)/NuGet.config'

0 commit comments

Comments
 (0)