Skip to content

Commit 2058595

Browse files
committed
Merged PR 681077: Add a pipeline definition for validating distribution and remoting on ADO
Adds a pipeline that does a clean build of the BuildXL repo with remoting enabled. This will be queued from our release pipeline
1 parent b77f614 commit 2058595

File tree

6 files changed

+224
-3
lines changed

6 files changed

+224
-3
lines changed

.azdo/common/journaling.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
steps:
2+
- script: 'C:\windows\system32\fsutil usn createjournal m=0x20000000 a=0x8000000 D:'
3+
displayName: 'Enable Journaling for D drive'

.azdo/common/set-artifacts-pat.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
parameters:
2+
- name: AzDevPAT
3+
type: string
4+
5+
steps:
6+
- powershell: |
7+
# Set environment variable for authenticating with Azure DevOps with a PAT as specified by AzureDevOps Artifact Services Drop task
8+
Write-Host "##vso[task.setvariable variable=ArtifactServices.Drop.PAT;issecret=true]${{ parameters.AzDevPAT }}"
9+
displayName: 'Set ArtifactServices Drop PAT'

.azdo/common/set-msvc-version.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
steps:
2+
- powershell: |
3+
$InstalledMsvcVersions=Get-ChildItem -Path 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC' -Directory -Name | Sort-Object
4+
5+
$PIPELINE_MSVC_VER=$null
6+
7+
if ( $InstalledMsvcVersions -is [system.array] )
8+
{
9+
# If multiple versions are found, then set to the last one
10+
$PIPELINE_MSVC_VER=$InstalledMsvcVersions[$InstalledMsvcVersions.Length-1]
11+
}
12+
else
13+
{
14+
$PIPELINE_MSVC_VER=$InstalledMsvcVersions
15+
}
16+
17+
Write-Host "##vso[task.setvariable variable=MSVC_VERSION;]$PIPELINE_MSVC_VER"
18+
displayName: 'Set MSVC version'
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# This pipeline does a clean build of the BuildXL repo as a distributed build
2+
# The BuildXL version to download from drop and use for the build (e.g., 0.1.0-20221026.0)
3+
# should be specified via the queue-time variable $(BuildXLPackageVersion)
4+
trigger: none # This pipeline is explicitly scheduled
5+
6+
variables:
7+
- group: "BuildXL Common variables"
8+
- group: "BuildXL Secrets"
9+
- name: Domino.DogfoodPackagePath
10+
value: $(System.DefaultWorkingDirectory)\$(Build.BuildId)\Dogfood
11+
- name: BuildXL.RepoDirectory
12+
value: $(Build.Repository.LocalPath)
13+
- name: BuildXL.LogsDirectory
14+
value: $(BuildXL.RepoDirectory)\Out\Logs
15+
- name: PatArgs
16+
value: -OneEsPat $(PAT-TseBuild-AzureDevOps-1esSharedAssets-Package-Read) -CbPat $(PAT-TseBuild-AzureDevOps-CloudBuild-Packaging-Read) -MsEngGitPat $(PAT-TseBuild-AzureDevOps-MsEng-ReadCode) -VstsPat $(PAT-TseBuild-AzureDevOps-mseng-buildcache)
17+
- name: DogfoodDropName
18+
value: buildxl.dogfood.$(BuildXLPackageVersion)
19+
- name: BxlScriptArgs
20+
value: -UseAdoBuildRunner -SharedCacheMode ConsumeAndPublish -Use Dev -DevRoot $(Domino.DogfoodPackagePath)\release\win-x64
21+
- name: BuildXLArgs
22+
value: /q:ReleaseDotNet6 /server- /p:[Sdk.BuildXL]microsoftInternal=1 /p:BUILDXL_FINGERPRINT_SALT=* /p:BuildXLWorkerAttachTimeoutMin=5 /logOutput:FullOutputOnWarningOrError /p:RetryXunitTests=1 /processRetries:3 /traceinfo:valdation=ReleasePipelineDistribution /enableIncrementalFrontEnd- /p:xunitSemaphoreCount=12
23+
24+
pool:
25+
name: BuildXL-DevOpsAgents-PME
26+
27+
jobs:
28+
- job: Distributed_Clean
29+
strategy:
30+
parallel: 2
31+
displayName: Clean distributed build
32+
steps:
33+
- checkout: self
34+
fetchDepth: 1
35+
36+
- template: ../common/set-artifacts-pat.yml
37+
parameters:
38+
AzDevPAT: $(PAT-TseBuild-AzureDevOps-MsEng)
39+
40+
- template: ../common/journaling.yml
41+
- template: ../common/set-msvc-version.yml
42+
43+
- task: ms-vscs-artifact.build-tasks.artifactDropDownloadTask-1.artifactDropDownloadTask@1
44+
displayName: 'Download $(DogfoodDropName) from drop'
45+
inputs:
46+
dropServiceURI: 'https://mseng.artifacts.visualstudio.com/DefaultCollection'
47+
buildNumber: '$(DogfoodDropName)'
48+
destinationPath: '$(Domino.DogfoodPackagePath)'
49+
rootPaths: 'release/win-x64'
50+
51+
- script: |
52+
netsh advfirewall set allprofiles state off
53+
displayName: Disable local firewall
54+
55+
- task: PowerShell@2
56+
inputs:
57+
targetType: filePath
58+
filePath: 'RunBxlWithPAT.ps1'
59+
arguments: '$(PatArgs) $(BxlScriptArgs) $(BuildXLArgs) /logsDirectory:$(BuildXL.LogsDirectory) /ado'
60+
workingDirectory: $(BuildXL.RepoDirectory)
61+
displayName: 'Run clean selfhost build distributed'
62+
env:
63+
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
64+
65+
- powershell: |
66+
$bxlWithRemotingLogDir = "$(BuildXL.LogsDirectory)"
67+
$statsContent = Get-Content -Path (Join-Path $bxlWithRemotingLogDir "BuildXL.stats") | Out-String
68+
$stats = ConvertFrom-StringData -StringData $statsContent
69+
$runDistributedCount = $stats.Get_Item("PipExecution.ProcessesExecutedRemotely")
70+
71+
Write-Host "Pips run on remote workers: $runDistributedCount"
72+
73+
if ($runDistributedCount -eq 0)
74+
{
75+
Write-Error "##[error]No process pip ran in distributed workers."
76+
exit 1
77+
}
78+
79+
exit 0
80+
displayName: 'Validate that distribution happened'
81+
condition: and(succeeded(), eq(variables['BUILDXL_DISTRIBUTED_ROLE'], 'BuildXLOrchestrator'))
82+
83+
- task: PublishPipelineArtifact@1
84+
displayName: 'Upload logs'
85+
inputs:
86+
targetPath: $(BuildXL.LogsDirectory)
87+
condition: always()

.azdo/remoting/selfhost-clean.yml

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# This pipeline does a clean build of the BuildXL repo with remoting enabled
2+
# The BuildXL version to download from drop and use for the build (e.g., 0.1.0-20221026.0)
3+
# should be specified via the queue-time variable $(BuildXLPackageVersion)
4+
trigger: none # This pipeline is explicitly scheduled
5+
6+
variables:
7+
- group: "BuildXL Common variables"
8+
- group: "BuildXL Secrets"
9+
- name: Domino.DogfoodPackagePath
10+
value: $(System.DefaultWorkingDirectory)\$(Build.BuildId)\Dogfood
11+
- name: BuildXL.RepoDirectory
12+
value: $(Build.Repository.LocalPath)
13+
- name: BuildXL.LogsDirectory
14+
value: $(BuildXL.RepoDirectory)\Out\Logs
15+
- name: BuildXLRemotingArgs
16+
value: /numRemoteAgentLeases:64 /remotingThresholdMultiplier:1.25
17+
- name: AnyBuildExtraArgs
18+
value: --ClientApplicationId~~$(BuildXLPipelinesAppId)~~--ClientSecretEnvironmentVariable~~AnyBuildServicePrincipalPasswd~~--NoCheckForUpdates
19+
- name: PatArgs
20+
value: -OneEsPat $(PAT-TseBuild-AzureDevOps-1esSharedAssets-Package-Read) -CbPat $(PAT-TseBuild-AzureDevOps-CloudBuild-Packaging-Read) -MsEngGitPat $(PAT-TseBuild-AzureDevOps-MsEng-ReadCode) -VstsPat $(PAT-TseBuild-AzureDevOps-mseng-buildcache)
21+
- name: DogfoodDropName
22+
value: buildxl.dogfood.$(BuildXLPackageVersion)
23+
- name: BxlScriptArgs
24+
value: -SharedCacheMode Disable -Use Dev -DevRoot $(Domino.DogfoodPackagePath)\release\win-x64 -EnableProcessRemoting
25+
- name: BuildXLArgs
26+
value: /q:ReleaseDotNet6 /server- /p:[Sdk.BuildXL]microsoftInternal=1 /p:BUILDXL_FINGERPRINT_SALT=* /p:BuildXLWorkerAttachTimeoutMin=5 /logOutput:FullOutputOnWarningOrError /p:RetryXunitTests=1 /processRetries:3 /traceinfo:valdation=ReleasePipelineRemoting /enableIncrementalFrontEnd- /p:xunitSemaphoreCount=12 /p:BUILDXL_ANYBUILD_EXTRA_ARGS=$(AnyBuildExtraArgs)
27+
28+
pool:
29+
name: BuildXL-DevOpsAgents-PME
30+
31+
jobs:
32+
- job: Distributed_Remoting
33+
displayName: Clean build with remoting
34+
steps:
35+
- checkout: self
36+
fetchDepth: 1
37+
38+
- template: ../common/set-artifacts-pat.yml
39+
parameters:
40+
AzDevPAT: $(PAT-TseBuild-AzureDevOps-MsEng)
41+
42+
- template: ./az-login.yml
43+
- template: ../common/journaling.yml
44+
- template: ../common/set-msvc-version.yml
45+
46+
- task: ms-vscs-artifact.build-tasks.artifactDropDownloadTask-1.artifactDropDownloadTask@1
47+
displayName: 'Download $(DogfoodDropName) from drop'
48+
inputs:
49+
dropServiceURI: 'https://mseng.artifacts.visualstudio.com/DefaultCollection'
50+
buildNumber: '$(DogfoodDropName)'
51+
destinationPath: '$(Domino.DogfoodPackagePath)'
52+
rootPaths: 'release/win-x64'
53+
54+
- powershell: 'Remove-Item -Force -Recurse "$env:LOCALAPPDATA\Microsoft\AnyBuild" -ea SilentlyContinue'
55+
displayName: 'Remove Existing AnyBuild'
56+
57+
- task: PowerShell@2
58+
inputs:
59+
targetType: filePath
60+
filePath: 'RunBxlWithPAT.ps1'
61+
arguments: '$(PatArgs) $(BxlScriptArgs) $(BuildXLArgs) $(BuildXLRemotingArgs) /logsDirectory:$(BuildXL.LogsDirectory) /ado'
62+
workingDirectory: $(BuildXL.RepoDirectory)
63+
displayName: 'Run clean selfhost build with remoting enabled'
64+
env:
65+
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
66+
AnyBuildServicePrincipalPasswd: $(AzureApp-BuildXL-Pipelines)
67+
68+
- powershell: |
69+
$bxlWithRemotingLogDir = "$(BuildXL.LogsDirectory)"
70+
$statsContent = Get-Content -Path (Join-Path $bxlWithRemotingLogDir "BuildXL.stats") | Out-String
71+
$stats = ConvertFrom-StringData -StringData $statsContent
72+
$runRemoteCount = $stats.Get_Item("PipExecution.TotalRunRemoteProcesses")
73+
$runDistributedCount = $stats.Get_Item("PipExecution.ProcessesExecutedRemotely")
74+
$runLocalFallbackCount = $stats.Get_Item("PipExecution.TotalRemoteFallbackRetries")
75+
76+
Write-Host "Run remote (AnyBuild): $runRemoteCount"
77+
Write-Host "Run on remote workers: $runDistributedCount"
78+
Write-Host "Run local due to fallback: $runLocalFallbackCount"
79+
80+
$exitcode = 0
81+
82+
if ($runRemoteCount -eq 0)
83+
{
84+
Write-Error "##[error]No process pip ran remotely. Please check AnyBuild.log."
85+
$exitcode = 1
86+
}
87+
88+
if ($runLocalFallbackCount -ne 0)
89+
{
90+
Write-Warning "##[warning]$runLocalFallbackCount remoted process pip(s) ran locally"
91+
}
92+
93+
exit $exitcode
94+
displayName: 'Validate process remoting'
95+
96+
- task: PublishPipelineArtifact@1
97+
displayName: 'Upload logs'
98+
inputs:
99+
targetPath: $(BuildXL.LogsDirectory)
100+
condition: always()

RunBxlWithPAT.ps1

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Param(
1111
[String]$OneEsPat,
1212
[Parameter(mandatory=$true)]
1313
[String]$CbPat,
14-
[Parameter(mandatory=$true)]
14+
[Parameter(mandatory=$false)]
1515
[String]$NcPath,
1616
[Parameter(mandatory=$true)]
1717
[String]$MsEngGitPat,
@@ -50,10 +50,14 @@ Param(
5050
[Environment]::SetEnvironmentVariable("1ESSHAREDASSETS_BUILDXL_FEED_PAT", $OneEsPat, "Process")
5151
[Environment]::SetEnvironmentVariable("CLOUDBUILD_BUILDXL_SELFHOST_FEED_PAT", $CbPat, "Process")
5252
[Environment]::SetEnvironmentVariable("MSENG_GIT_PAT", $MsEngGitPat, "Process")
53-
[Environment]::SetEnvironmentVariable("NUGET_CREDENTIALPROVIDERS_PATH", $NcPath, "Process")
5453
[Environment]::SetEnvironmentVariable("VSTSPERSONALACCESSTOKEN", $VstsPat, "Process")
5554
[Environment]::SetEnvironmentVariable("ARTIFACT_CREDENTIALPROVIDERS_PATH", $VstsCredProviderPath, "Process")
5655

56+
if ($NcPath)
57+
{
58+
[Environment]::SetEnvironmentVariable("NUGET_CREDENTIALPROVIDERS_PATH", $NcPath, "Process")
59+
}
60+
5761
[Environment]::SetEnvironmentVariable("VSS_NUGET_EXTERNAL_FEED_ENDPOINTS", "
5862
{
5963
'endpointCredentials': [
@@ -98,4 +102,4 @@ $BxlCmdArgs += $BxlArgs
98102

99103
Write-Host "Call bxl.cmd $BxlCmdArgs"
100104

101-
.\bxl.cmd $BxlCmdArgs
105+
.\bxl.cmd $BxlCmdArgs

0 commit comments

Comments
 (0)