-
Notifications
You must be signed in to change notification settings - Fork 34
/
azure-pipelines.yml
252 lines (246 loc) · 9.79 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
trigger:
branches:
include:
- main
paths:
exclude:
- .github
- doc
- '*.md'
schedules:
- cron: "0 10 * * Sun"
displayName: Weekly api-scan
always: true
branches:
include:
- main
parameters:
- name: RunApiScanTools
displayName: Run API Scan?
type: boolean
default: false
variables:
NugetSecurityAnalysisWarningLevel: none
${{ if or(eq(parameters.RunApiScanTools, 'true'), eq(variables['Build.CronSchedule.DisplayName'], 'Weekly api-scan')) }}:
RunAPIScan: true
${{ else }}:
RunAPIScan: false
Codeql.Enabled: true
Codeql.TSAEnabled: true
Codeql.TSAOptionsPath: $(Build.SourcesDirectory)\azure-pipelines\TSAOptions.json
resources:
repositories:
- repository: MicroBuildTemplate
type: git
name: 1ESPipelineTemplates/MicroBuildTemplate
ref: refs/tags/release
extends:
template: azure-pipelines/MicroBuild.1ES.Official.yml@MicroBuildTemplate
parameters:
sdl:
sourceAnalysisPool:
name: VSEngSS-MicroBuild2022-1ES
image: server2022-microbuildVS2022-1es
pool:
name: VSEngSS-MicroBuild2022-1ES
image: server2022-microbuildVS2022-1es
os: windows
customBuildTags:
- ES365AIMigrationTooling
stages:
- stage: stage
jobs:
- job: job
templateContext:
mb:
signing:
enabled: true
signType: $(SignType)
zipSources: false
feedSource: 'https://pkgs.dev.azure.com/devdiv/_packaging/MicroBuildToolset/nuget/v3/index.json' # Optional parameter: Artifact feed for outside DevDiv.
azureSubscription: 'MicroBuild Signing Task (DevDiv)' # Optional parameter: Microbuild Service Connection.
outputs:
# - output: pipelineArtifact
# displayName: 'Publish Artifact: ESRP signing logs'
# condition: eq(variables['SignType'], 'real')
# targetPath: $(Build.ArtifactStagingDirectory)/MicroBuild/ESRPClient
# artifactName: esrpclient_logs
# artifactType: Container
- output: pipelineArtifact
displayName: 'Publish Artifact: build logs'
condition: succeededOrFailed()
targetPath: $(Build.ArtifactStagingDirectory)/build_logs
artifactName: build_logs
artifactType: Container
- output: pipelineArtifact
displayName: 'Publish Artifact: symbols'
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
targetPath: '$(Build.ArtifactStagingDirectory)/symbols'
artifactName: symbols
publishLocation: Container
- output: pipelineArtifact
displayName: 'Publish packages'
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
targetPath: $(Build.ArtifactStagingDirectory)/packages
artifactName: packages
artifactType: Container
- output: nuget
displayName: 'Publish Sdk NuGet packages to VSTS feeds'
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
packageParentPath: '$(Build.ArtifactStagingDirectory)'
searchPatternPush: 'bin/$(BuildConfiguration)/packages/*.nupkg'
publishVstsFeed: $(feedGuid)
allowPackageConflicts: true
steps:
- checkout: self
fetchDepth: 0
- task: ComponentGovernanceComponentDetection@0
inputs:
scanType: 'Register'
verbosity: 'Verbose'
alertWarningLevel: 'High'
- task: PowerShell@2
displayName: Set VSTS variables
inputs:
targetType: inline
script: |
if ($env:SignType -eq 'Real') {
$feedGuid = '09d8d03c-1ac8-456e-9274-4d2364527d99' ## VSIDE-RealSigned-Release
} else {
$feedGuid = 'da484c78-f942-44ef-b197-99e2a1bef53c' ## VSIDE-TestSigned-Release
}
Write-Host "##vso[task.setvariable variable=feedGuid]$feedGuid"
$SkipPublishingNetworkArtifacts = 'true' ## Network artifacts not allowed on Scale Set Pool
Write-Host "##vso[task.setvariable variable=SkipPublishingNetworkArtifacts]$SkipPublishingNetworkArtifacts"
if ($env:ComputerName.StartsWith('factoryvm', [StringComparison]::OrdinalIgnoreCase)) {
Write-Host "Running on hosted queue"
Write-Host "##vso[task.setvariable variable=Hosted]true"
}
- task: CmdLine@2
inputs:
script: |
del /s /q "bin"
displayName: Purge bin
- task: NuGetToolInstaller@0
displayName: Pin nuget.exe version
inputs:
versionSpec: 6.4.0
- task: NuGetAuthenticate@1
displayName: 'NuGet Authenticate'
inputs:
forceReinstallCredentialProvider: true
- task: VSBuild@1
inputs:
vsVersion: 15.0
solution: 'src\jdt.sln'
msbuildArgs: /t:Restore
platform: $(BuildPlatform)
configuration: $(BuildConfiguration)
displayName: Restore jdt solution
- task: VSBuild@1
inputs:
vsVersion: 15.0
solution: 'src\jdt.sln'
msbuildArgs: '/bl:"$(Build.ArtifactStagingDirectory)/build_logs/jdt.binlog"'
platform: $(BuildPlatform)
configuration: $(BuildConfiguration)
displayName: Build jdt solution
- task: MicroBuildCodesignVerify@3
inputs:
TargetFolders: |
$(Build.SourcesDirectory)\bin\$(BuildConfiguration)\packages
ApprovalListPathForCerts: $(Build.SourcesDirectory)\src\build\no_authenticode.txt
ApprovalListPathForSigs: $(Build.SourcesDirectory)\src\build\no_strongname.txt
displayName: Verify code signing
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
- task: VSTest@2
inputs:
testFiltercriteria: TestCategory!=FailsInCloudTest
searchFolder: $(System.DefaultWorkingDirectory)\bin\
testAssemblyVer2: |
$(BuildConfiguration)\**\net472\*test*.dll
!**\obj\**
platform: $(BuildPlatform)
configuration: $(BuildConfiguration)
diagnosticsEnabled: true
displayName: Run Tests
condition: and(succeeded(), ne(variables['SignType'], 'real'))
- task: AntiMalware@4
displayName: 'Run MpCmdRun.exe'
inputs:
InputType: Basic
ScanType: CustomScan
FileDirPath: '$(Build.StagingDirectory)'
DisableRemediation: false
- task: PoliCheck@2
displayName: 'Run PoliCheck'
inputs:
targetType: F
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
- task: ManifestGeneratorTask@0
inputs:
BuildDropPath: $(Build.ArtifactStagingDirectory)/build_logs
- task: BinSkim@4
displayName: Run BinSkim
inputs:
InputType: 'Basic'
Function: 'analyze'
TargetPattern: 'guardianGlob'
AnalyzeTargetGlob: 'bin/$(BuildConfiguration)/net472/Microsoft.VisualStudio.Jdt*.dll;'
- task: CopyFiles@2
displayName: 'Copy Files for APIScan'
inputs:
SourceFolder: 'bin/$(BuildConfiguration)/net472/'
Contents: |
**/Microsoft.VisualStudio.Jdt*.dll
**/Microsoft.VisualStudio.Jdt*.pdb
TargetFolder: $(Agent.TempDirectory)\APIScanFiles
condition: and(succeeded(), eq(variables['RunApiScan'], 'true'))
- task: APIScan@2
displayName: Run APIScan
inputs:
softwareFolder: $(Agent.TempDirectory)\APIScanFiles
softwareName: 'json-document-transform'
softwareVersionNum: '$(Build.BuildId)'
isLargeApp: false
toolVersion: 'Latest'
condition: and(succeeded(), eq(variables['RunApiScan'], 'true'))
env:
AzureServicesAuthConnectionString: RunAs=App;AppId=$(ApiScanClientId)
- task: PublishSecurityAnalysisLogs@3
displayName: 'Publish Guardian Artifacts'
inputs:
ArtifactName: CodeAnalysisLogs
ArtifactType: Container
PublishProcessedResults: false
AllTools: true
- task: TSAUpload@2
displayName: 'Create bugs for APIScan'
inputs:
GdnPublishTsaOnboard: true
GdnPublishTsaConfigFile: '$(Build.SourcesDirectory)\azure-pipelines\TSAOptions.json'
condition: eq(variables['RunApiScan'], 'true')
- task: CopyFiles@1
displayName: Collecting symbols artifacts
inputs:
SourceFolder: bin/$(BuildConfiguration)/net472
Contents: |
**/Microsoft.VisualStudio.Jdt?(*.dll|*.pdb|*.xml)
!**/*Test*
TargetFolder: $(Build.ArtifactStagingDirectory)/symbols
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
- task: MicroBuildArchiveSymbols@5
displayName: 🔣 Archive symbols to Symweb
inputs:
SymbolsFeatureName: $(SymbolsFeatureName)
SymbolsProject: VS
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'), eq(variables['SignType'], 'real'))
- task: CopyFiles@1
displayName: Collecting packages
inputs:
SourceFolder: bin/$(BuildConfiguration)/packages
Contents: |
*.nupkg
TargetFolder: $(Build.ArtifactStagingDirectory)/packages
flattenFolders: false
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))