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