|
| 1 | +# Pipeline creates experimental msbuild insertions. |
| 2 | + |
| 3 | +trigger: none # Prevents this pipeline from triggering on check-ins |
| 4 | +pr: none # don't run this on PR as well |
| 5 | + |
| 6 | +parameters: |
| 7 | + # Dotnet installer channel from which to take the latest dotnet bits. |
| 8 | + - name: DotnetInstallerChannel |
| 9 | + displayName: Dotnet installer channel |
| 10 | + type: string |
| 11 | + default: 'none' |
| 12 | + # VS version for which to take the latest Retail MSBuild bits. |
| 13 | + - name: VSVersionName |
| 14 | + displayName: VS Version |
| 15 | + type: string |
| 16 | + default: 'none' |
| 17 | + # Branch from the MSBuild Build CI pipeline. Default: main |
| 18 | + # Top run for the branch would be used to create an experimental insertion. |
| 19 | + - name: MSBuildBranch |
| 20 | + displayName: MSBuild Branch |
| 21 | + type: string |
| 22 | + default: 'refs/heads/main' |
| 23 | + # BuildID from the MSBuild Build CI pipeline. Overrides the choice of MSBuildBranch parameter |
| 24 | + - name: MSBuildBuildID |
| 25 | + displayName: MSBuild CI Run Override |
| 26 | + type: string |
| 27 | + default: 'default' |
| 28 | + |
| 29 | +variables: |
| 30 | + - name: _MsBuildCiPipelineId |
| 31 | + value: 9434 |
| 32 | + - name: _MSBuildConfigFilePathRequestURL |
| 33 | + 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' |
| 34 | + - name: VSVersion |
| 35 | + value: ${{parameters.VSVersionName}} |
| 36 | + |
| 37 | +pool: |
| 38 | + vmImage: windows-latest |
| 39 | + |
| 40 | +jobs: |
| 41 | +- job: CreateExpDotnet |
| 42 | + displayName: Create Experimental Dotnet |
| 43 | + condition: ne('${{ parameters.DotnetInstallerChannel }}', 'none') |
| 44 | + steps: |
| 45 | + - powershell: | |
| 46 | + mkdir '$(System.ArtifactsDirectory)/installer' |
| 47 | +
|
| 48 | + $dotnetChannel = '${{parameters.DotnetInstallerChannel}}' |
| 49 | + $sdks = "dotnet-sdk-win-x64.zip", "dotnet-sdk-linux-x64.tar.gz" |
| 50 | +
|
| 51 | + foreach ($sdk in $sdks) |
| 52 | + { |
| 53 | + Write-Host "Downloading dotnet $sdk from channel $dotnetChannel" |
| 54 | + Invoke-WebRequest ` |
| 55 | + -Uri "https://aka.ms/dotnet/$dotnetChannel/daily/$sdk" ` |
| 56 | + -OutFile "$(System.ArtifactsDirectory)/installer/$sdk" |
| 57 | + } |
| 58 | + mkdir '$(Pipeline.Workspace)/artifacts' |
| 59 | + displayName: Download latest dotnet sdks |
| 60 | +
|
| 61 | + - task: DownloadBuildArtifacts@1 |
| 62 | + inputs: |
| 63 | + buildType: specific |
| 64 | + project: DevDiv |
| 65 | + pipeline: $(_MsBuildCiPipelineId) |
| 66 | + ${{ if eq(parameters.MSBuildBuildID, 'default') }}: |
| 67 | + buildVersionToDownload: latestFromBranch |
| 68 | + branchName: '${{parameters.MSBuildBranch}}' |
| 69 | + ${{ else }}: |
| 70 | + buildVersionToDownload: specific |
| 71 | + buildId: ${{parameters.MSBuildBuildID}} |
| 72 | + artifactName: bin |
| 73 | + itemPattern: 'MSBuild.Bootstrap/**' |
| 74 | + downloadPath: '$(System.ArtifactsDirectory)/msbuild/artifacts/bin' |
| 75 | + displayName: Download msbuild artifacts |
| 76 | + |
| 77 | + - powershell: | |
| 78 | + $sdk = "dotnet-sdk-win-x64" |
| 79 | +
|
| 80 | + Write-Host "Extracting $(System.ArtifactsDirectory)/installer/$sdk.zip" |
| 81 | + Expand-Archive "$(System.ArtifactsDirectory)/installer/$sdk.zip" -DestinationPath "$(Pipeline.Workspace)/exp-dotnet/$sdk" |
| 82 | +
|
| 83 | + $dotnetDirectory = Get-ChildItem -Directory -Path "$(Pipeline.Workspace)/exp-dotnet/$sdk/sdk" |
| 84 | + $dotnetVersion = $dotnetDirectory.Name |
| 85 | + Write-Host "Detected dotnet version: $dotnetVersion" |
| 86 | +
|
| 87 | + Write-Host "Updating MSBuild dlls." |
| 88 | + $(Build.SourcesDirectory)/scripts/Deploy-MSBuild.ps1 ` |
| 89 | + -destination "$(Pipeline.Workspace)/exp-dotnet/$sdk/sdk/$dotnetVersion" ` |
| 90 | + -binDirectory "$(System.ArtifactsDirectory)/msbuild/artifacts/bin" ` |
| 91 | + -configuration Release ` |
| 92 | + -makeBackup $false |
| 93 | +
|
| 94 | + Write-Host "Compressing dotnet sdk files" |
| 95 | + Get-ChildItem -Path "$(Pipeline.Workspace)/exp-dotnet/$sdk" | Compress-Archive -DestinationPath "$(Pipeline.Workspace)/artifacts/$sdk.zip" |
| 96 | +
|
| 97 | + displayName: Dogfood msbuild dlls to dotnet sdk win-x64 |
| 98 | +
|
| 99 | + - powershell: | |
| 100 | + $sdk = "dotnet-sdk-linux-x64" |
| 101 | +
|
| 102 | + mkdir "$(Pipeline.Workspace)/exp-dotnet/$sdk" |
| 103 | +
|
| 104 | + Write-Host "Extracting $(System.ArtifactsDirectory)/installer/$sdk.tar.gz" |
| 105 | + tar -xzvf "$(System.ArtifactsDirectory)/installer/$sdk.tar.gz" -C "$(Pipeline.Workspace)/exp-dotnet/$sdk" |
| 106 | +
|
| 107 | + $dotnetDirectory = Get-ChildItem -Directory -Path $(Pipeline.Workspace)/exp-dotnet/$sdk/sdk |
| 108 | + $dotnetVersion = $dotnetDirectory.Name |
| 109 | + Write-Host "Detected dotnet version: $dotnetVersion" |
| 110 | +
|
| 111 | + Write-Host "Updating MSBuild dlls." |
| 112 | + $(Build.SourcesDirectory)/scripts/Deploy-MSBuild.ps1 ` |
| 113 | + -destination "$(Pipeline.Workspace)/exp-dotnet/$sdk/sdk/$dotnetVersion" ` |
| 114 | + -binDirectory "$(System.ArtifactsDirectory)/msbuild/artifacts/bin" ` |
| 115 | + -configuration Release ` |
| 116 | + -makeBackup $false |
| 117 | +
|
| 118 | + Write-Host "Compressing dotnet sdk files" |
| 119 | + tar -czvf "$(Pipeline.Workspace)/artifacts/$sdk.tar.gz" -C "$(Pipeline.Workspace)/exp-dotnet/$sdk" . |
| 120 | + displayName: Dogfood msbuild dlls to dotnet sdk linux-x64 |
| 121 | +
|
| 122 | + - task: PublishPipelineArtifact@1 |
| 123 | + inputs: |
| 124 | + targetPath: '$(Pipeline.Workspace)/artifacts' |
| 125 | + artifactName: ExperimentalDotnet |
| 126 | + parallel: true |
| 127 | + condition: always() |
| 128 | + displayName: Publish crank assests artifacts |
| 129 | + |
| 130 | + |
| 131 | +- job: CreateExpMSBuild |
| 132 | + displayName: "Create Experimental MSBuild" |
| 133 | + condition: ne('${{ parameters.VSVersionName }}', 'none') |
| 134 | + steps: |
| 135 | + - powershell: | |
| 136 | + $token = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes("PAT:$env:ACCESSTOKEN")) |
| 137 | + $headers = @{ Authorization = "Basic $token" }; |
| 138 | + $response = Invoke-RestMethod -Uri "$(_MSBuildConfigFilePathRequestURL)" -Headers $headers -Method Get |
| 139 | + $MSBuildDropPath = $response.Tools.MSBuild.Locations |
| 140 | + Write-Host "##vso[task.setvariable variable=MSBuildDropPath]$MSBuildDropPath" |
| 141 | + Write-Host "MSBuild Drop Path directory: $MSBuildDropPath" |
| 142 | + displayName: Get Retail MSBuild Drop Path |
| 143 | + env: |
| 144 | + ACCESSTOKEN: $(cloudbuild-token) |
| 145 | +
|
| 146 | + - task: NuGetToolInstaller@1 |
| 147 | + displayName: 'Install NuGet.exe' |
| 148 | + |
| 149 | + - task: NuGetCommand@2 |
| 150 | + displayName: Restore internal tools |
| 151 | + inputs: |
| 152 | + command: restore |
| 153 | + feedsToUse: config |
| 154 | + restoreSolution: '$(Build.SourcesDirectory)\eng\common\internal\Tools.csproj' |
| 155 | + nugetConfigPath: '$(Build.SourcesDirectory)\NuGet.config' |
| 156 | + restoreDirectory: '$(Build.SourcesDirectory)\.packages' |
| 157 | + |
| 158 | + - powershell: | |
| 159 | + mkdir "$(Pipeline.Workspace)/artifacts" |
| 160 | +
|
| 161 | + $dropAppDirectory = Get-ChildItem -Directory -Path "$(Build.SourcesDirectory)/.packages/drop.app" |
| 162 | + $dropAppVersion = $dropAppDirectory.Name |
| 163 | + Write-Host "Detected drop.exe version: $dropAppVersion" |
| 164 | +
|
| 165 | + $dropExePath = "$(Build.SourcesDirectory)/.packages/drop.app/$dropAppVersion/lib/net45/drop.exe" |
| 166 | + Write-Host "Detected drop.exe path: $dropExePath" |
| 167 | +
|
| 168 | + Write-Host "Downloading VS msbuild" |
| 169 | + & "$dropExePath" get --patAuthEnvVar 'cloudbuild-token' -u "$(MSBuildDropPath)\$(VSVersion)" -d "$(System.ArtifactsDirectory)/VSMSBuildDrop" |
| 170 | + Write-Host "Download of VS msbuild finished" |
| 171 | +
|
| 172 | + Write-Host "Copying VS msbuild to $(Pipeline.Workspace)/VSMSBuild" |
| 173 | + Copy-Item -Path "$(System.ArtifactsDirectory)/VSMSBuildDrop/*" -Destination "$(Pipeline.Workspace)/VSMSBuild" -Recurse |
| 174 | + Write-Host "Copy of VS msbuild finished" |
| 175 | + displayName: Download msbuild vs drop |
| 176 | + env: |
| 177 | + cloudbuild-token: $(cloudbuild-token) |
| 178 | +
|
| 179 | + - task: DownloadBuildArtifacts@1 |
| 180 | + inputs: |
| 181 | + buildType: specific |
| 182 | + project: DevDiv |
| 183 | + pipeline: $(_MsBuildCiPipelineId) |
| 184 | + ${{ if eq(parameters.MSBuildBuildID, 'default') }}: |
| 185 | + buildVersionToDownload: latestFromBranch |
| 186 | + branchName: '${{parameters.MSBuildBranch}}' |
| 187 | + ${{ else }}: |
| 188 | + buildVersionToDownload: specific |
| 189 | + buildId: ${{parameters.MSBuildBuildID}} |
| 190 | + artifactName: bin |
| 191 | + itemPattern: | |
| 192 | + MSBuild.Bootstrap/*/net472/** |
| 193 | + Microsoft.Build.Conversion/*/net472/Microsoft.Build.Conversion.Core.dll |
| 194 | + Microsoft.Build.Engine/*/net472/Microsoft.Build.Engine.dll |
| 195 | + MSBuildTaskHost/**/MSBuildTaskHost.exe |
| 196 | + MSBuildTaskHost/**/MSBuildTaskHost.pdb |
| 197 | + MSBuild/*/*/net472/MSBuild.exe* |
| 198 | + downloadPath: '$(System.ArtifactsDirectory)/msbuild/artifacts/bin' |
| 199 | + displayName: Download msbuild artifacts |
| 200 | + |
| 201 | + - powershell: | |
| 202 | + Write-Host "Updating MSBuild dlls." |
| 203 | + $(Build.SourcesDirectory)/scripts/Deploy-MSBuild.ps1 ` |
| 204 | + -destination "$(Pipeline.Workspace)/VSMSBuild/$(VSVersion)/MSBuild/Current/Bin" ` |
| 205 | + -binDirectory "$(System.ArtifactsDirectory)/msbuild/artifacts/bin" ` |
| 206 | + -configuration Release ` |
| 207 | + -makeBackup $false |
| 208 | +
|
| 209 | + ls "$(Pipeline.Workspace)/VSMSBuild/$(VSVersion)" |
| 210 | + Write-Host "Compressing msbuild files" |
| 211 | + Get-ChildItem -Path "$(Pipeline.Workspace)/VSMSBuild/$(VSVersion)" | Compress-Archive -DestinationPath "$(Pipeline.Workspace)/artifacts/MSBuild.zip" |
| 212 | + displayName: Dogfood msbuild dlls |
| 213 | +
|
| 214 | + - task: PublishPipelineArtifact@1 |
| 215 | + inputs: |
| 216 | + targetPath: '$(Pipeline.Workspace)/artifacts' |
| 217 | + artifactName: ExperimentalMSBuild |
| 218 | + parallel: true |
| 219 | + condition: always() |
| 220 | + displayName: Publish crank assests artifacts |
0 commit comments