2023-10-12 11:03:38 +03:00
|
|
|
# Pipeline creates experimental msbuild insertions.
|
2023-09-26 16:27:01 +03:00
|
|
|
|
|
|
|
trigger: none # Prevents this pipeline from triggering on check-ins
|
|
|
|
pr: none # don't run this on PR as well
|
|
|
|
|
|
|
|
parameters:
|
2023-10-12 11:03:38 +03:00
|
|
|
# Dotnet installer channel from which to take the latest dotnet bits.
|
2023-09-26 16:27:01 +03:00
|
|
|
- name: DotnetInstallerChannel
|
|
|
|
displayName: Dotnet installer channel
|
2023-10-18 05:22:05 +03:00
|
|
|
type: string
|
2023-10-12 11:03:38 +03:00
|
|
|
default: 'none'
|
|
|
|
# VS version for which to take the latest Retail MSBuild bits.
|
|
|
|
- name: VSVersionName
|
|
|
|
displayName: VS Version
|
2023-09-26 16:27:01 +03:00
|
|
|
type: string
|
2023-10-12 11:03:38 +03:00
|
|
|
default: 'none'
|
2023-09-26 16:27:01 +03:00
|
|
|
# Branch from the MSBuild Build CI pipeline. Default: main
|
2023-10-18 05:22:05 +03:00
|
|
|
# Top run for the branch would be used to create an experimental insertion.
|
2023-09-26 16:27:01 +03:00
|
|
|
- name: MSBuildBranch
|
|
|
|
displayName: MSBuild Branch
|
|
|
|
type: string
|
|
|
|
default: 'refs/heads/main'
|
2023-10-18 05:22:05 +03:00
|
|
|
# BuildID from the MSBuild Build CI pipeline. Overrides the choice of MSBuildBranch parameter
|
2023-09-26 16:27:01 +03:00
|
|
|
- name: MSBuildBuildID
|
|
|
|
displayName: MSBuild CI Run Override
|
|
|
|
type: string
|
|
|
|
default: 'default'
|
|
|
|
|
|
|
|
variables:
|
|
|
|
- name: _MsBuildCiPipelineId
|
|
|
|
value: 9434
|
2023-10-18 05:22:05 +03:00
|
|
|
- name: _MSBuildConfigFilePathRequestURL
|
|
|
|
value: 'https://dev.azure.com/cloudbuild/CloudBuild/_apis/git/repositories/CloudBuildConfig/items?versionDescriptor.version=main&path=config/batmon/Q-Prod-Co3/Coordinator/ToolsReleaseConfig-GeneralPublic.json&api-version=5.0'
|
2023-10-12 11:03:38 +03:00
|
|
|
- name: VSVersion
|
|
|
|
value: ${{parameters.VSVersionName}}
|
2023-09-26 16:27:01 +03:00
|
|
|
|
|
|
|
pool:
|
|
|
|
vmImage: windows-latest
|
|
|
|
|
2023-10-12 11:03:38 +03:00
|
|
|
jobs:
|
|
|
|
- job: CreateExpDotnet
|
|
|
|
displayName: Create Experimental Dotnet
|
|
|
|
condition: ne('${{ parameters.DotnetInstallerChannel }}', 'none')
|
|
|
|
steps:
|
|
|
|
- powershell: |
|
|
|
|
mkdir '$(System.ArtifactsDirectory)/installer'
|
|
|
|
|
|
|
|
$dotnetChannel = '${{parameters.DotnetInstallerChannel}}'
|
|
|
|
$sdks = "dotnet-sdk-win-x64.zip", "dotnet-sdk-linux-x64.tar.gz"
|
|
|
|
|
|
|
|
foreach ($sdk in $sdks)
|
|
|
|
{
|
|
|
|
Write-Host "Downloading dotnet $sdk from channel $dotnetChannel"
|
|
|
|
Invoke-WebRequest `
|
|
|
|
-Uri "https://aka.ms/dotnet/$dotnetChannel/daily/$sdk" `
|
|
|
|
-OutFile "$(System.ArtifactsDirectory)/installer/$sdk"
|
|
|
|
}
|
|
|
|
mkdir '$(Pipeline.Workspace)/artifacts'
|
|
|
|
displayName: Download latest dotnet sdks
|
2023-09-26 16:27:01 +03:00
|
|
|
|
|
|
|
- task: DownloadBuildArtifacts@1
|
|
|
|
inputs:
|
|
|
|
buildType: specific
|
|
|
|
project: DevDiv
|
2023-10-18 05:22:05 +03:00
|
|
|
pipeline: $(_MsBuildCiPipelineId)
|
|
|
|
${{ if eq(parameters.MSBuildBuildID, 'default') }}:
|
2023-10-12 11:03:38 +03:00
|
|
|
buildVersionToDownload: latestFromBranch
|
|
|
|
branchName: '${{parameters.MSBuildBranch}}'
|
|
|
|
${{ else }}:
|
|
|
|
buildVersionToDownload: specific
|
2023-10-18 05:22:05 +03:00
|
|
|
buildId: ${{parameters.MSBuildBuildID}}
|
2023-09-26 16:27:01 +03:00
|
|
|
artifactName: bin
|
2023-10-18 05:22:05 +03:00
|
|
|
itemPattern: 'MSBuild.Bootstrap/**'
|
2023-09-26 16:27:01 +03:00
|
|
|
downloadPath: '$(System.ArtifactsDirectory)/msbuild/artifacts/bin'
|
2023-10-12 11:03:38 +03:00
|
|
|
displayName: Download msbuild artifacts
|
2023-09-26 16:27:01 +03:00
|
|
|
|
2023-10-12 11:03:38 +03:00
|
|
|
- powershell: |
|
|
|
|
$sdk = "dotnet-sdk-win-x64"
|
|
|
|
|
|
|
|
Write-Host "Extracting $(System.ArtifactsDirectory)/installer/$sdk.zip"
|
|
|
|
Expand-Archive "$(System.ArtifactsDirectory)/installer/$sdk.zip" -DestinationPath "$(Pipeline.Workspace)/exp-dotnet/$sdk"
|
2023-10-18 05:22:05 +03:00
|
|
|
|
2023-10-12 11:03:38 +03:00
|
|
|
$dotnetDirectory = Get-ChildItem -Directory -Path "$(Pipeline.Workspace)/exp-dotnet/$sdk/sdk"
|
|
|
|
$dotnetVersion = $dotnetDirectory.Name
|
|
|
|
Write-Host "Detected dotnet version: $dotnetVersion"
|
2023-10-18 05:22:05 +03:00
|
|
|
|
2023-10-12 11:03:38 +03:00
|
|
|
Write-Host "Updating MSBuild dlls."
|
|
|
|
$(Build.SourcesDirectory)/scripts/Deploy-MSBuild.ps1 `
|
|
|
|
-destination "$(Pipeline.Workspace)/exp-dotnet/$sdk/sdk/$dotnetVersion" `
|
|
|
|
-binDirectory "$(System.ArtifactsDirectory)/msbuild/artifacts/bin" `
|
|
|
|
-configuration Release `
|
|
|
|
-makeBackup $false
|
2023-10-18 05:22:05 +03:00
|
|
|
|
2023-10-12 11:03:38 +03:00
|
|
|
Write-Host "Compressing dotnet sdk files"
|
|
|
|
Get-ChildItem -Path "$(Pipeline.Workspace)/exp-dotnet/$sdk" | Compress-Archive -DestinationPath "$(Pipeline.Workspace)/artifacts/$sdk.zip"
|
2023-09-26 16:27:01 +03:00
|
|
|
|
2023-10-12 11:03:38 +03:00
|
|
|
displayName: Dogfood msbuild dlls to dotnet sdk win-x64
|
2023-09-26 16:27:01 +03:00
|
|
|
|
2023-10-12 11:03:38 +03:00
|
|
|
- powershell: |
|
|
|
|
$sdk = "dotnet-sdk-linux-x64"
|
2023-10-18 05:22:05 +03:00
|
|
|
|
2023-10-12 11:03:38 +03:00
|
|
|
mkdir "$(Pipeline.Workspace)/exp-dotnet/$sdk"
|
2023-09-26 16:27:01 +03:00
|
|
|
|
2023-10-12 11:03:38 +03:00
|
|
|
Write-Host "Extracting $(System.ArtifactsDirectory)/installer/$sdk.tar.gz"
|
|
|
|
tar -xzvf "$(System.ArtifactsDirectory)/installer/$sdk.tar.gz" -C "$(Pipeline.Workspace)/exp-dotnet/$sdk"
|
2023-09-26 16:27:01 +03:00
|
|
|
|
2023-10-12 11:03:38 +03:00
|
|
|
$dotnetDirectory = Get-ChildItem -Directory -Path $(Pipeline.Workspace)/exp-dotnet/$sdk/sdk
|
|
|
|
$dotnetVersion = $dotnetDirectory.Name
|
|
|
|
Write-Host "Detected dotnet version: $dotnetVersion"
|
2023-10-18 05:22:05 +03:00
|
|
|
|
2023-10-12 11:03:38 +03:00
|
|
|
Write-Host "Updating MSBuild dlls."
|
|
|
|
$(Build.SourcesDirectory)/scripts/Deploy-MSBuild.ps1 `
|
|
|
|
-destination "$(Pipeline.Workspace)/exp-dotnet/$sdk/sdk/$dotnetVersion" `
|
|
|
|
-binDirectory "$(System.ArtifactsDirectory)/msbuild/artifacts/bin" `
|
|
|
|
-configuration Release `
|
|
|
|
-makeBackup $false
|
2023-10-18 05:22:05 +03:00
|
|
|
|
2023-10-12 11:03:38 +03:00
|
|
|
Write-Host "Compressing dotnet sdk files"
|
|
|
|
tar -czvf "$(Pipeline.Workspace)/artifacts/$sdk.tar.gz" -C "$(Pipeline.Workspace)/exp-dotnet/$sdk" .
|
|
|
|
displayName: Dogfood msbuild dlls to dotnet sdk linux-x64
|
|
|
|
|
|
|
|
- task: PublishPipelineArtifact@1
|
|
|
|
inputs:
|
|
|
|
targetPath: '$(Pipeline.Workspace)/artifacts'
|
|
|
|
artifactName: ExperimentalDotnet
|
|
|
|
parallel: true
|
|
|
|
condition: always()
|
|
|
|
displayName: Publish crank assests artifacts
|
|
|
|
|
|
|
|
|
|
|
|
- job: CreateExpMSBuild
|
|
|
|
displayName: "Create Experimental MSBuild"
|
|
|
|
condition: ne('${{ parameters.VSVersionName }}', 'none')
|
|
|
|
steps:
|
|
|
|
- powershell: |
|
2023-10-18 05:22:05 +03:00
|
|
|
$token = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes("PAT:$env:ACCESSTOKEN"))
|
|
|
|
$headers = @{ Authorization = "Basic $token" };
|
|
|
|
$response = Invoke-RestMethod -Uri "$(_MSBuildConfigFilePathRequestURL)" -Headers $headers -Method Get
|
|
|
|
$MSBuildDropPath = $response.Tools.MSBuild.Locations
|
2023-10-12 11:03:38 +03:00
|
|
|
Write-Host "##vso[task.setvariable variable=MSBuildDropPath]$MSBuildDropPath"
|
|
|
|
Write-Host "MSBuild Drop Path directory: $MSBuildDropPath"
|
|
|
|
displayName: Get Retail MSBuild Drop Path
|
2023-10-18 05:22:05 +03:00
|
|
|
env:
|
|
|
|
ACCESSTOKEN: $(cloudbuild-token)
|
|
|
|
|
2023-10-12 11:03:38 +03:00
|
|
|
- task: NuGetToolInstaller@1
|
|
|
|
displayName: 'Install NuGet.exe'
|
|
|
|
|
|
|
|
- task: NuGetCommand@2
|
|
|
|
displayName: Restore internal tools
|
|
|
|
inputs:
|
|
|
|
command: restore
|
|
|
|
feedsToUse: config
|
2023-10-18 05:22:05 +03:00
|
|
|
restoreSolution: '$(Build.SourcesDirectory)\eng\common\internal\Tools.csproj'
|
|
|
|
nugetConfigPath: '$(Build.SourcesDirectory)\NuGet.config'
|
|
|
|
restoreDirectory: '$(Build.SourcesDirectory)\.packages'
|
|
|
|
|
2024-07-15 12:31:20 +03:00
|
|
|
# https://eng.ms/docs/cloud-ai-platform/devdiv/one-engineering-system-1es/1es-docs/1es-security-configuration/configuration-guides/pat-burndown-guidance#authentication-from-pipelines
|
|
|
|
# Requires Azure client 2.x
|
|
|
|
- task: AzureCLI@2
|
|
|
|
displayName: 'Set AzDO.DotnetPerfStarToken'
|
|
|
|
enabled: true
|
|
|
|
inputs:
|
|
|
|
azureSubscription: 'dotnet-perfstar at app.vssps.visualstudio.com' # Azure DevOps service connection
|
|
|
|
scriptType: 'pscore'
|
|
|
|
scriptLocation: 'inlineScript'
|
|
|
|
inlineScript: |
|
|
|
|
# '499b84ac-1321-427f-aa17-267ca6975798' for Azure DevOps
|
|
|
|
$token = az account get-access-token --query accessToken --resource 499b84ac-1321-427f-aa17-267ca6975798 -o tsv
|
|
|
|
Write-Host "Setting AzDO.DotnetPerfStarToken"
|
|
|
|
Write-Host "##vso[task.setvariable variable=AzDO.DotnetPerfStarToken]${token}"
|
|
|
|
|
2023-10-12 11:03:38 +03:00
|
|
|
- powershell: |
|
|
|
|
mkdir "$(Pipeline.Workspace)/artifacts"
|
2023-10-18 05:22:05 +03:00
|
|
|
|
|
|
|
$dropAppDirectory = Get-ChildItem -Directory -Path "$(Build.SourcesDirectory)/.packages/drop.app"
|
2023-10-12 11:03:38 +03:00
|
|
|
$dropAppVersion = $dropAppDirectory.Name
|
|
|
|
Write-Host "Detected drop.exe version: $dropAppVersion"
|
|
|
|
|
2023-10-18 05:22:05 +03:00
|
|
|
$dropExePath = "$(Build.SourcesDirectory)/.packages/drop.app/$dropAppVersion/lib/net45/drop.exe"
|
2023-10-12 11:03:38 +03:00
|
|
|
Write-Host "Detected drop.exe path: $dropExePath"
|
|
|
|
|
|
|
|
Write-Host "Downloading VS msbuild"
|
2024-07-15 12:31:20 +03:00
|
|
|
$patAuthEnvVar = "patVariable"
|
2024-05-31 18:17:31 +03:00
|
|
|
& "$dropExePath" get --patAuthEnvVar $patAuthEnvVar -u "$(MSBuildDropPath)\$(VSVersion)" -d "$(System.ArtifactsDirectory)/VSMSBuildDrop"
|
2023-10-12 11:03:38 +03:00
|
|
|
Write-Host "Download of VS msbuild finished"
|
|
|
|
|
|
|
|
Write-Host "Copying VS msbuild to $(Pipeline.Workspace)/VSMSBuild"
|
|
|
|
Copy-Item -Path "$(System.ArtifactsDirectory)/VSMSBuildDrop/*" -Destination "$(Pipeline.Workspace)/VSMSBuild" -Recurse
|
|
|
|
Write-Host "Copy of VS msbuild finished"
|
|
|
|
displayName: Download msbuild vs drop
|
|
|
|
env:
|
2024-07-15 12:31:20 +03:00
|
|
|
patVariable: $(AzDO.DotnetPerfStarToken)
|
2023-10-18 05:22:05 +03:00
|
|
|
|
2023-10-12 11:03:38 +03:00
|
|
|
- task: DownloadBuildArtifacts@1
|
|
|
|
inputs:
|
|
|
|
buildType: specific
|
|
|
|
project: DevDiv
|
2023-10-18 05:22:05 +03:00
|
|
|
pipeline: $(_MsBuildCiPipelineId)
|
|
|
|
${{ if eq(parameters.MSBuildBuildID, 'default') }}:
|
2023-10-12 11:03:38 +03:00
|
|
|
buildVersionToDownload: latestFromBranch
|
|
|
|
branchName: '${{parameters.MSBuildBranch}}'
|
|
|
|
${{ else }}:
|
|
|
|
buildVersionToDownload: specific
|
2023-10-18 05:22:05 +03:00
|
|
|
buildId: ${{parameters.MSBuildBuildID}}
|
2023-10-12 11:03:38 +03:00
|
|
|
artifactName: bin
|
2023-10-18 05:22:05 +03:00
|
|
|
itemPattern: |
|
|
|
|
MSBuild.Bootstrap/*/net472/**
|
|
|
|
Microsoft.Build.Conversion/*/net472/Microsoft.Build.Conversion.Core.dll
|
|
|
|
Microsoft.Build.Engine/*/net472/Microsoft.Build.Engine.dll
|
|
|
|
MSBuildTaskHost/**/MSBuildTaskHost.exe
|
|
|
|
MSBuildTaskHost/**/MSBuildTaskHost.pdb
|
|
|
|
MSBuild/*/*/net472/MSBuild.exe*
|
2023-10-12 11:03:38 +03:00
|
|
|
downloadPath: '$(System.ArtifactsDirectory)/msbuild/artifacts/bin'
|
|
|
|
displayName: Download msbuild artifacts
|
|
|
|
|
|
|
|
- powershell: |
|
|
|
|
Write-Host "Updating MSBuild dlls."
|
2023-10-18 05:22:05 +03:00
|
|
|
$(Build.SourcesDirectory)/scripts/Deploy-MSBuild.ps1 `
|
2023-10-12 11:03:38 +03:00
|
|
|
-destination "$(Pipeline.Workspace)/VSMSBuild/$(VSVersion)/MSBuild/Current/Bin" `
|
|
|
|
-binDirectory "$(System.ArtifactsDirectory)/msbuild/artifacts/bin" `
|
|
|
|
-configuration Release `
|
|
|
|
-makeBackup $false
|
|
|
|
|
|
|
|
ls "$(Pipeline.Workspace)/VSMSBuild/$(VSVersion)"
|
|
|
|
Write-Host "Compressing msbuild files"
|
|
|
|
Get-ChildItem -Path "$(Pipeline.Workspace)/VSMSBuild/$(VSVersion)" | Compress-Archive -DestinationPath "$(Pipeline.Workspace)/artifacts/MSBuild.zip"
|
2023-10-18 05:22:05 +03:00
|
|
|
displayName: Dogfood msbuild dlls
|
2023-10-12 11:03:38 +03:00
|
|
|
|
|
|
|
- task: PublishPipelineArtifact@1
|
|
|
|
inputs:
|
|
|
|
targetPath: '$(Pipeline.Workspace)/artifacts'
|
|
|
|
artifactName: ExperimentalMSBuild
|
|
|
|
parallel: true
|
|
|
|
condition: always()
|
|
|
|
displayName: Publish crank assests artifacts
|