forked from dotnet/roslyn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines-official.yml
341 lines (308 loc) · 14.5 KB
/
azure-pipelines-official.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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
resources:
- repo: self
clean: true
# Variables defined in yml cannot be overridden at queue time instead overrideable variables must be defined in the web gui.
# Commenting out until AzDO supports something like the runtime parameters outlined here: https://github.com/Microsoft/azure-pipelines-yaml/pull/129
#variables:
# SignType: real
# SkipTests: false
# SkipApplyOptimizationData: false
# IbcDrop: 'default'
# PRNumber: 'default'
# The variables `_DotNetArtifactsCategory` and `_DotNetValidationArtifactsCategory` are required for proper publishing of build artifacts. See https://github.com/dotnet/roslyn/pull/38259
variables:
- name: _DotNetArtifactsCategory
value: .NETCore
- name: _DotNetValidationArtifactsCategory
value: .NETCoreValidation
- group: DotNet-Roslyn-SDLValidation-Params
# To retrieve OptProf data we need to authenticate to the VS drop storage.
# If the pipeline is running in DevDiv, the account has access to the VS drop storage.
# Get $AccessToken-dotnet-build-bot-public-repo from DotNet-GitHub-Versions-Repo-Write
- ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}:
- group: DotNet-GitHub-Versions-Repo-Write
- name: _DevDivDropAccessToken
value: $(System.AccessToken)
# If the pipeline is running in dnceng:
# Get access token with $dn-bot-devdiv-drop-rw-code-rw from DotNet-VSTS-Infra-Access
# Get $dotnetfeed-storage-access-key-1 from DotNet-Blob-Feed
# Get $microsoft-symbol-server-pat and $symweb-symbol-server-pat from DotNet-Symbol-Server-Pats
# Get $AccessToken-dotnet-build-bot-public-repo from DotNet-Versions-Publish
- ${{ if eq(variables['System.TeamProject'], 'internal') }}:
- group: DotNet-Blob-Feed
- group: DotNet-Symbol-Server-Pats
- group: DotNet-Versions-Publish
- group: DotNet-VSTS-Infra-Access
- name: _DevDivDropAccessToken
value: $(dn-bot-devdiv-drop-rw-code-rw)
stages:
- stage: build
displayName: Build and Test
jobs:
- job: OfficialBuild
displayName: Official Build
timeoutInMinutes: 360
# Conditionally set build pool so we can share this YAML when building with different pipeline (devdiv vs dnceng)
pool:
${{ if eq(variables['System.TeamProject'], 'DevDiv') }}:
name: VSEng-MicroBuildVS2017
demands:
- msbuild
- visualstudio
- DotNetFramework
${{ if eq(variables['System.TeamProject'], 'internal') }}:
name: NetCoreInternal-Pool
queue: BuildPool.Windows.10.Amd64.VS2019.Pre
steps:
# Make sure our two pipelines generate builds with distinct build numbers to avoid confliction.
# i.e. DevDiv builds will have even rev# whereas dnceng builds will be odd.
- task: PowerShell@2
displayName: Update BuildNumber
inputs:
filePath: 'eng\update-build-number.ps1'
${{ if eq(variables['System.TeamProject'], 'DevDiv') }}:
arguments: '-buildNumber $(Build.BuildNumber) -oddOrEven even'
${{ if eq(variables['System.TeamProject'], 'internal') }}:
arguments: '-buildNumber $(Build.BuildNumber) -oddOrEven odd'
- powershell: Write-Host "##vso[task.setvariable variable=SourceBranchName]$('$(Build.SourceBranch)'.Substring('refs/heads/'.Length))"
displayName: Setting SourceBranchName variable
condition: succeeded()
- task: tagBuildOrRelease@0
displayName: Tag official build
inputs:
type: 'Build'
tags: 'OfficialBuild'
condition: and(succeeded(), endsWith(variables['SourceBranchName'], '-vs-deps'), eq(variables['PRNumber'], 'default'))
- task: tagBuildOrRelease@0
displayName: Tag PR validation build
inputs:
type: 'Build'
tags: |
PRValidationBuild
PRNumber:$(PRNumber)
condition: and(succeeded(), ne(variables['PRNumber'], 'default'))
- task: PowerShell@2
displayName: Setup branch for insertion validation
inputs:
filePath: 'eng\setup-pr-validation.ps1'
arguments: '-sourceBranchName $(SourceBranchName) -prNumber $(PRNumber)'
condition: and(succeeded(), ne(variables['PRNumber'], 'default'))
- task: tagBuildOrRelease@0
displayName: Tag master validation build
inputs:
type: 'Build'
tags: |
MasterValidationBuild
condition: and(succeeded(), eq(variables['SourceBranchName'], 'master'))
- powershell: git pull origin master-vs-deps
displayName: Merge master-vs-deps into source branch
condition: and(succeeded(), eq(variables['SourceBranchName'], 'master'))
- powershell: Write-Host "##vso[task.setvariable variable=VisualStudio.DropName]Products/$(System.TeamProject)/$(Build.Repository.Name)/$(SourceBranchName)/$(Build.BuildNumber)"
displayName: Setting VisualStudio.DropName variable
- task: NuGetToolInstaller@0
inputs:
versionSpec: '4.9.2'
# Authenticate with service connections to be able to publish packages to external nuget feeds.
- task: NuGetAuthenticate@0
inputs:
${{ if eq(variables['System.TeamProject'], 'DevDiv') }}:
nuGetServiceConnections: azure-public/vs-impl, azure-public/vssdk
${{ if eq(variables['System.TeamProject'], 'internal') }}:
nuGetServiceConnections: azure-public/vs-impl, azure-public/vssdk, devdiv/engineering
- task: NuGetCommand@2
displayName: Restore internal tools
inputs:
command: restore
feedsToUse: config
restoreSolution: 'eng\common\internal\Tools.csproj'
nugetConfigPath: 'NuGet.config'
restoreDirectory: '$(Build.SourcesDirectory)\.packages'
- task: MicroBuildSigningPlugin@2
inputs:
signType: $(SignType)
zipSources: false
# If running in dnceng, we need to use a feed different from default
${{ if eq(variables['System.TeamProject'], 'internal') }}:
feedSource: https://dnceng.pkgs.visualstudio.com/_packaging/MicroBuildToolset/nuget/v3/index.json
condition: and(succeeded(), in(variables['SignType'], 'test', 'real'))
- task: PowerShell@2
displayName: Build
inputs:
filePath: eng/build.ps1
arguments: -ci
-restore
-build
-pack
-sign
-publish
-binaryLog
-configuration $(BuildConfiguration)
-officialBuildId $(Build.BuildNumber)
-officialSkipTests $(SkipTests)
-officialSkipApplyOptimizationData $(SkipApplyOptimizationData)
-officialSourceBranchName $(SourceBranchName)
-officialIbcDrop $(IbcDrop)
-officialVisualStudioDropAccessToken $(_DevDivDropAccessToken)
/p:RepositoryName=$(Build.Repository.Name)
/p:VisualStudioDropName=$(VisualStudio.DropName)
/p:DotNetSignType=$(SignType)
/p:DotNetPublishToBlobFeed=true
/p:DotNetPublishBlobFeedKey=$(dotnetfeed-storage-access-key-1)
/p:DotNetPublishBlobFeedUrl=https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json
/p:PublishToSymbolServer=true
/p:DotNetSymbolServerTokenMsdl=$(microsoft-symbol-server-pat)
/p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat)
/p:DotNetArtifactsCategory=$(_DotNetArtifactsCategory)
/p:DotnetPublishUsingPipelines=true
condition: succeeded()
- task: PowerShell@2
displayName: Publish Assets
inputs:
filePath: 'eng\publish-assets.ps1'
arguments: '-configuration $(BuildConfiguration) -branchName "$(SourceBranchName)" -gitHubUserName $(Roslyn.GitHubUserName) -gitHubToken $(AccessToken-dotnet-build-bot-public-repo) -gitHubEmail $(Roslyn.GitHubEmail)'
condition: and(succeeded(), eq(variables['PRNumber'], 'default'))
# Publish OptProf configuration files
# The env variable is required to enable cross account access using PAT (dnceng -> devdiv)
- task: ms-vscs-artifact.build-tasks.artifactDropTask-1.artifactDropTask@0
env:
ARTIFACTSERVICES_DROP_PAT: $(_DevDivDropAccessToken)
inputs:
dropServiceURI: 'https://devdiv.artifacts.visualstudio.com'
buildNumber: 'ProfilingInputs/DevDiv/$(Build.Repository.Name)/$(SourceBranchName)/$(Build.BuildNumber)'
sourcePath: '$(Build.SourcesDirectory)\artifacts\OptProf\$(BuildConfiguration)\Data'
toLowerCase: false
usePat: false
retentionDays: 90
displayName: 'OptProf - Publish to Artifact Services - ProfilingInputs'
condition: succeeded()
# Publish OptProf generated JSON files as a build artifact. This allows for easy inspection from
# a build execution.
- task: PublishBuildArtifacts@1
displayName: Publish OptProf Data Files
inputs:
PathtoPublish: '$(Build.SourcesDirectory)\artifacts\OptProf\$(BuildConfiguration)\Data'
ArtifactName: 'OptProf Data Files'
condition: succeeded()
- task: PublishBuildArtifacts@1
displayName: Publish Logs
inputs:
PathtoPublish: '$(Build.SourcesDirectory)\artifacts\log\$(BuildConfiguration)'
ArtifactName: 'Build Diagnostic Files'
publishLocation: Container
continueOnError: true
condition: succeededOrFailed()
- task: PublishBuildArtifacts@1
displayName: Publish Ngen Logs
inputs:
PathtoPublish: '$(Build.SourcesDirectory)\artifacts\log\$(BuildConfiguration)\ngen'
ArtifactName: 'NGen Logs'
publishLocation: Container
continueOnError: true
condition: succeeded()
- task: PublishTestResults@2
displayName: Publish xUnit Test Results
inputs:
testRunner: XUnit
testResultsFiles: '$(Build.SourcesDirectory)\artifacts\TestResults\$(BuildConfiguration)\*.xml'
mergeTestResults: true
testRunTitle: 'Unit Tests'
condition: and(succeededOrFailed(), ne(variables['SkipTests'], 'true'))
# Publishes setup VSIXes to a drop.
# Note: The insertion tool looks for the display name of this task in the logs.
- task: ms-vseng.MicroBuildTasks.4305a8de-ba66-4d8b-b2d1-0dc4ecbbf5e8.MicroBuildUploadVstsDropFolder@1
displayName: Upload VSTS Drop
inputs:
DropName: $(VisualStudio.DropName)
DropFolder: 'artifacts\VSSetup\$(BuildConfiguration)\Insertion'
AccessToken: $(_DevDivDropAccessToken)
condition: succeeded()
# Publish insertion packages to CoreXT store.
- task: NuGetCommand@2
displayName: Publish CoreXT Packages
inputs:
command: push
packagesToPush: '$(Build.SourcesDirectory)\artifacts\VSSetup\$(BuildConfiguration)\DevDivPackages\**\*.nupkg'
allowPackageConflicts: true
${{ if eq(variables['System.TeamProject'], 'DevDiv') }}:
feedsToUse: config
publishVstsFeed: '97a41293-2972-4f48-8c0e-05493ae82010'
${{ if eq(variables['System.TeamProject'], 'internal') }}:
nuGetFeedType: external
publishFeedCredentials: 'DevDiv - VS package feed'
condition: succeeded()
# Publish an artifact that the RoslynInsertionTool is able to find by its name.
- task: PublishBuildArtifacts@1
displayName: Publish Artifact VSSetup
inputs:
PathtoPublish: 'artifacts\VSSetup\$(BuildConfiguration)'
ArtifactName: 'VSSetup'
condition: succeeded()
# Publish our NuPkgs as an artifact. The name of this artifact must be PackageArtifacts as the
# arcade templates depend on the name.
- task: PublishBuildArtifacts@1
displayName: Publish Artifact Packages
inputs:
PathtoPublish: 'artifacts\packages\$(BuildConfiguration)'
ArtifactName: 'PackageArtifacts'
condition: succeeded()
# Publish Asset Manifests for Build Asset Registry job
- task: PublishBuildArtifacts@1
displayName: Publish Asset Manifests
inputs:
PathtoPublish: '$(Build.SourcesDirectory)/artifacts/log/$(BuildConfiguration)/AssetManifest'
ArtifactName: AssetManifests
condition: succeeded()
- task: ms-vseng.MicroBuildTasks.521a94ea-9e68-468a-8167-6dcf361ea776.MicroBuildCleanup@1
displayName: Perform Cleanup Tasks
condition: succeededOrFailed()
# Publish to Build Asset Registry
- template: /eng/common/templates/job/publish-build-assets.yml
parameters:
publishUsingPipelines: true
dependsOn:
- OfficialBuild
${{ if eq(variables['System.TeamProject'], 'DevDiv') }}:
queue:
name: Hosted VS2017
${{ if eq(variables['System.TeamProject'], 'internal') }}:
pool:
vmImage: vs2017-win2016
# We need to skip post-build stages for PR validation build, but it can only be identified by
# the runtime variable 'PRNumber', thus this dummy stage. Also the dummy job is required
# otherwise AzDO would just repeat jobs from previous stage.
- stage: SetValidateDependency
displayName: Setup the dependency for post-build stages
condition: and(succeeded(), eq(variables['PRNumber'], 'default'))
jobs:
- job: Log
displayName: Log
steps:
- powershell: Write-Host "Setup the dependency for post-build stages."
displayName: Log
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
- template: eng\common\templates\post-build\post-build.yml
parameters:
# Symbol validation is not entirely reliable as of yet, so should be turned off until
# https://github.com/dotnet/arcade/issues/2871 is resolved.
enableSymbolValidation: false
enableSourceLinkValidation: false
# It's important that post-build stages are depends on 'SetValidateDependency' stage instead of 'build',
# since we don't want to publish validation build.
validateDependsOn:
- SetValidateDependency
dependsOn:
- SetValidateDependency
# Enable SDL validation, passing through values from the 'DotNet-Roslyn-SDLValidation-Params' group.
SDLValidationParameters:
enable: true
params: >-
-SourceToolsList @("policheck","credscan")
-TsaInstanceURL $(_TsaInstanceURL)
-TsaProjectName $(_TsaProjectName)
-TsaNotificationEmail $(_TsaNotificationEmail)
-TsaCodebaseAdmin $(_TsaCodebaseAdmin)
-TsaBugAreaPath $(_TsaBugAreaPath)
-TsaIterationPath $(_TsaIterationPath)
-TsaRepositoryName $(_TsaRepositoryName)
-TsaCodebaseName $(_TsaCodebaseName)
-TsaPublish $True