forked from rokonec/arcade-services
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
323 lines (286 loc) · 15.3 KB
/
azure-pipelines.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
variables:
# Cannot use key:value syntax in root defined variables
- name: _TeamName
value: DotNetCore
- name: _PublishUsingPipelines
value: true
- name: _DotNetArtifactsCategory
value: .NETCore
- name: skipComponentGovernanceDetection
value: true
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
- group: SDL_Settings
# CI and PR triggers
trigger:
batch: true
branches:
include:
- master
- production
pr:
- master
- production
stages:
- stage: build
displayName: Build
# Three phases for each of the three OSes we want to run on
jobs:
- template: /eng/common/templates/jobs/jobs.yml
parameters:
enableMicrobuild: false
enablePublishBuildArtifacts: true
enablePublishTestResults: false
enablePublishBuildAssets: true
enablePublishUsingPipelines: ${{ variables._PublishUsingPipelines }}
enableTelemetry: true
helixRepo: dotnet/arcade-services
jobs:
- job: Windows_NT
timeoutInMinutes: 90
pool:
vmImage: windows-2019
variables:
- _InternalBuildArgs: ''
- _ProductionArgs: ''
# Only enable publishing in non-public, non PR scenarios.
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
# DotNet-Blob-Feed provides: dotnetfeed-storage-access-key-1
# DotNet-Symbol-Server-Pats provides: microsoft-symbol-server-pat, symweb-symbol-server-pat
# Publish-Build-Assets provides: MaestroAccessToken, BotAccount-dotnet-maestro-bot-PAT
- group: DotNet-Blob-Feed
- group: DotNet-Symbol-Server-Pats
- group: Publish-Build-Assets
- _PublishBlobFeedUrl: https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json
- _InternalBuildArgs: /p:DotNetSignType=$(_SignType) /p:TeamName=$(_TeamName)
/p:DotNetPublishBlobFeedKey=$(dotnetfeed-storage-access-key-1)
/p:DotNetPublishBlobFeedUrl=$(_PublishBlobFeedUrl)
/p:DotNetPublishToBlobFeed=$(_DotNetPublishToBlobFeed)
/p:DotNetPublishUsingPipelines=$(_PublishUsingPipelines)
/p:DotNetArtifactsCategory=$(_DotNetArtifactsCategory)
/p:DotNetSymbolServerTokenMsdl=$(microsoft-symbol-server-pat)
/p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat)
/p:OfficialBuildId=$(BUILD.BUILDNUMBER)
# In production, create stable package versions
# TODO: We depend on a prerelease version of Microsoft.TeamFoundationServer.Client
# https://github.com/dotnet/arcade-services/issues/59
# and so we can't stabilize for right now.
# - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), eq(variables['Build.SourceBranchName'], 'production')) }}:
# - _ProductionArgs: /p:DotNetFinalVersionKind=release
strategy:
matrix:
# Only build debug in non-official builds
${{ if or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest')) }}:
debug_configuration:
_BuildConfig: Debug
_PublishType: none
_SignType: test
_DotNetPublishToBlobFeed : false
release_configuration:
_BuildConfig: Release
# PRs or external builds are not signed.
${{ if or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest')) }}:
_PublishType: none
_SignType: test
_DotNetPublishToBlobFeed : false
${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
_PublishType: blob
_SignType: test
_DotNetPublishToBlobFeed : true
steps:
- checkout: self
clean: true
- task: UseDotNet@2
displayName: Install Correct .NET Version
inputs:
useGlobalJson: true
- task: NuGetToolInstaller@0
inputs:
versionSpec: 5.5.x
- task: NodeTool@0
inputs:
versionSpec: 12.x
- task: NuGetCommand@2
displayName: Restore Packages
inputs:
command: restore
solution: "**/*.sln"
feedstoUse: config
- powershell: eng\set-version-parameters.ps1
displayName: Calculate release version variables
- powershell: |
[xml]$manifest = Get-Content src\Maestro\MaestroApplication\ApplicationPackageRoot\ApplicationManifest.xml
$manifest.SelectSingleNode("/*[local-name()='ApplicationManifest']/*[local-name()='Policies']").RemoveAll()
$manifest.SelectSingleNode("/*[local-name()='ApplicationManifest']/*[local-name()='Principals']").RemoveAll()
$manifest.Save("src\Maestro\MaestroApplication\ApplicationPackageRoot\ApplicationManifest.xml")
git diff
displayName: Remove Service Fabric RunAsPolicy
- script: eng\common\cibuild.cmd
-configuration $(_BuildConfig)
-prepareMachine
$(_InternalBuildArgs)
$(_ProductionArgs)
/p:Test=false
/P:Sign=false
name: Build
displayName: Build / Publish
condition: succeeded()
- task: ComponentGovernanceComponentDetection@0
inputs:
# `.packages` directory is used by some tools running during build.
# By default ComponentDetection scans this directory and sometimes reports
# vulnerabilities for packages that are not part of the published product.
# We can ignore this directory because actual vulnerabilities
# that we are interested in will be found by the tool
# when scanning .csproj and package.json files.
ignoreDirectories: '.packages'
- template: /eng/test.yaml
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
## Prepare service fabric artifact
- task: ServiceFabricUpdateManifests@2
inputs:
applicationPackagePath: $(Build.ArtifactStagingDirectory)\ServiceFabric\MaestroApplication\applicationpackage
- powershell: |
robocopy src/Maestro/MaestroApplication/PublishProfiles $(Build.ArtifactStagingDirectory)\ServiceFabric\MaestroApplication\projectartifacts\PublishProfiles /S *.xml
robocopy src/Maestro/MaestroApplication/ApplicationParameters $(Build.ArtifactStagingDirectory)\ServiceFabric\MaestroApplication\projectartifacts\ApplicationParameters /S *.xml
robocopy src/Maestro/MaestroApplication/ApplicationPackageRoot $(Build.ArtifactStagingDirectory)\ServiceFabric\MaestroApplication\projectartifacts\ApplicationPackageRoot /S *.xml
exit 0
displayName: Copy Maestro Project Artifacts
- publish: $(Build.ArtifactStagingDirectory)\ServiceFabric\MaestroApplication
artifact: MaestroApplication
displayName: Publish MaestroApplication
- task: ServiceFabricUpdateManifests@2
inputs:
applicationPackagePath: $(Build.ArtifactStagingDirectory)\ServiceFabric\TelemetryApplication\applicationpackage
- powershell: |
robocopy src/Telemetry/TelemetryApplication/PublishProfiles $(Build.ArtifactStagingDirectory)\ServiceFabric\TelemetryApplication\projectartifacts\PublishProfiles /S *.xml
robocopy src/Telemetry/TelemetryApplication/ApplicationParameters $(Build.ArtifactStagingDirectory)\ServiceFabric\TelemetryApplication\projectartifacts\ApplicationParameters /S *.xml
robocopy src/Telemetry/TelemetryApplication/ApplicationPackageRoot $(Build.ArtifactStagingDirectory)\ServiceFabric\TelemetryApplication\projectartifacts\ApplicationPackageRoot /S *.xml
exit 0
displayName: Copy Telemetry Project Artifacts
- publish: $(Build.ArtifactStagingDirectory)\ServiceFabric\TelemetryApplication
artifact: TelemetryApplication
displayName: Publish TelemetryApplication
- script: $(Build.SourcesDirectory)\.dotnet\dotnet publish -o $(Build.ArtifactStagingDirectory)\DotNet.Status.Web\publish -f netcoreapp3.1
workingDirectory: src/DotNet.Status.Web
displayName: dotnet publish DotNet.Status.Web
- task: ArchiveFiles@2
inputs:
rootFolderOrFile: $(Build.ArtifactStagingDirectory)/DotNet.Status.Web/publish
includeRootFolder: false
archiveType: zip
archiveFile: $(Build.ArtifactStagingDirectory)/DotNet.Status.Web/package/DotNetStatus.zip
replaceExistingArchive: true
- publish: $(Build.ArtifactStagingDirectory)/DotNet.Status.Web/package
artifact: DotNetStatus
displayName: Publish DotNet.Status.Web
- script: $(Build.SourcesDirectory)\.dotnet\dotnet publish -o $(Build.ArtifactStagingDirectory)\RolloutScorerAzureFunction\publish -f netcoreapp3.1
workingDirectory: src/RolloutScorer/RolloutScorerAzureFunction
displayName: dotnet publish RolloutScorerAzureFunction
- task: ArchiveFiles@2
inputs:
rootFolderOrFile: $(Build.ArtifactStagingDirectory)/RolloutScorerAzureFunction/publish
includeRootFolder: false
archiveType: zip
archiveFile: $(Build.ArtifactStagingDirectory)/RolloutScorerAzureFunction/package/RolloutScorer.zip
replaceExistingArchive: true
- publish: $(Build.ArtifactStagingDirectory)/RolloutScorerAzureFunction/package
artifact: RolloutScorer
displayName: Publish RolloutScorerAzureFunction
## Prepare database update artifact
- script: $(Build.SourcesDirectory)\.dotnet\dotnet publish -o $(Build.ArtifactStagingDirectory)\Maestro.Data -f netcoreapp3.1
workingDirectory: src/Maestro/Maestro.Data
displayName: Create Data Package
- task: CopyFiles@2
displayName: Copy update-database.ps1
inputs:
sourceFolder: $(Build.SourcesDirectory)\src\Maestro
contents: update-database.ps1
targetFolder: $(Build.ArtifactStagingDirectory)\Maestro.Data\
- task: PublishBuildArtifacts@1
displayName: Publish Maestro.Data Artifact
inputs:
PathtoPublish: $(Build.ArtifactStagingDirectory)\Maestro.Data
ArtifactName: Maestro.Data
ArtifactType: Container
## Prepare release utilities artifact
- task: CopyFiles@2
displayName: Prepare Release Utilities
inputs:
sourceFolder: $(Build.SourcesDirectory)\eng
contents: '*'
targetFolder: $(Build.ArtifactStagingDirectory)\eng
- publish: $(Build.ArtifactStagingDirectory)\eng
artifact: ReleaseUtilities
displayName: Publish Release Utilities Artifact
## Prepare scenario tests artifact
- task: CopyFiles@2
displayName: Prepare Scenario test scripts
inputs:
sourceFolder: $(Build.SourcesDirectory)\src\maestro\tests\scenarios
contents: '*'
targetFolder: $(Build.ArtifactStagingDirectory)\tests\scenarios
- task: PublishBuildArtifacts@1
displayName: Publish Scenario test scripts Artifact
inputs:
PathtoPublish: $(Build.ArtifactStagingDirectory)\tests\scenarios
ArtifactName: ScenarioTests
ArtifactType: Container
- publish: $(Build.SourcesDirectory)\artifacts\bin\Maestro.ScenarioTests\$(_BuildConfig)\netcoreapp3.1\publish
artifact: Maestro.ScenarioTests
# Reenable tagging when stable package versions can be generated.
# https://github.com/dotnet/arcade-services/issues/59
# - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), eq(variables['Build.SourceBranchName'], 'production')) }}:
# - powershell: eng\create-tag.ps1 -AccessToken $(System.AccessToken)
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
- template: eng\common\templates\post-build\post-build.yml
parameters:
# Symbol validation isn't being very reliable lately. This should be enabled back
# once this issue is resolved: https://github.com/dotnet/arcade/issues/2871
enableSymbolValidation: false
enableSigningValidation: false
# This is to enable SDL runs part of Post-Build Validation Stage
SDLValidationParameters:
enable: true
params: '-SourceToolsList @("policheck","credscan")
-TsaInstanceURL $(_TsaInstanceURL)
-TsaProjectName $(_TsaProjectName)
-TsaNotificationEmail $(_TsaNotificationEmail)
-TsaCodebaseAdmin $(_TsaCodebaseAdmin)
-TsaBugAreaPath $(_TsaBugAreaPath)
-TsaIterationPath $(_TsaIterationPath)
-TsaRepositoryName "Arcade-Services"
-TsaCodebaseName "Arcade-Services"
-TsaPublish $True'
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), in(variables['Build.SourceBranch'], 'refs/heads/master', 'refs/heads/production'))}}:
- template: eng\deploy.yaml
parameters:
${{ if ne(variables['Build.SourceBranch'], 'refs/heads/production') }}:
DeploymentEnvironment: Staging
DotNetStatusAppName: dotneteng-status-staging
DotNetStatusEndpoint: .NET Engineering Deployment Notification - Staging
MaestroPublishEndpoint: https://maestro-prod.westus2.cloudapp.azure.com
MaestroTestEndpoint: https://maestro-int.westus2.cloudapp.azure.com
PublishProfile: Int
RolloutScorerAppName: rollout-scorer-int
ServiceFabricConnection: Maestro-Int
Subscription: NetHelixStaging
VariableGroup: MaestroInt KeyVault
StatusVariableGroup: DotNetStatus Staging
GrafanaHost: https://dotnet-eng-grafana-staging.westus2.cloudapp.azure.com
GrafanaKeyVault: dotnet-grafana-staging
GrafanaVariableGroup: Dotnet-Grafana-Staging
${{ if eq(variables['Build.SourceBranch'], 'refs/heads/production') }}:
DeploymentEnvironment: Production
DotNetStatusAppName: dotneteng-status
DotNetStatusEndpoint: .NET Engineering Deployment Notification - Production
MaestroPublishEndpoint: https://maestro-prod.westus2.cloudapp.azure.com
MaestroTestEndpoint: https://maestro-prod.westus2.cloudapp.azure.com
PublishProfile: Prod
RolloutScorerAppName: rollout-scorer-prod
ServiceFabricConnection: Maestro-Prod
Subscription: NetHelix
VariableGroup: MaestroProd KeyVault
StatusVariableGroup: DotNetStatus Production
GrafanaHost: https://dotnet-eng-grafana.westus2.cloudapp.azure.com
GrafanaKeyVault: dotnet-grafana
GrafanaVariableGroup: Dotnet-Grafana-Production