-
Notifications
You must be signed in to change notification settings - Fork 48
/
azure-pipelines.yml
248 lines (223 loc) · 7.29 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
# ASP.NET Core (.NET Framework)
# Build and test ASP.NET Core projects targeting the full .NET Framework.
# Add steps that publish symbols, save build artifacts, and more:
# https://learn.microsoft.com/azure/devops/pipelines/languages/dotnet-core
trigger:
- '*'
name: $(SourceBranchName)-$(Date:yyyyMMdd)$(Rev:.r)
variables:
solution: 'apidoctools.sln'
buildConfiguration: 'Release'
mdocPath: 'bin/$(buildConfiguration)'
stages:
- stage: SDLCheck
jobs:
- job: SDLCheck
pool:
vmImage: 'windows-latest'
steps:
- task: CredScan@2
displayName: Security - CredScan
inputs:
toolMajorVersion: 'V2'
- task: CmdLine@2
displayName: make prepare
inputs:
script: 'make prepare'
- task: MSBuild@1
displayName: MSBuild
inputs:
solution: '$(solution)'
configuration: '$(buildConfiguration)'
- task: BinSkim@3
displayName: Security - BinSkim
inputs:
InputType: 'Basic'
Function: 'analyze'
AnalyzeTarget: '$(mdocPath)\*.dll;$(mdocPath)\*.exe;'
- task: SdtReport@1
displayName: Security - SdtReport
inputs:
AllTools: false
CredScan: true
BinSkim: true
ToolLogsNotFoundAction: 'Standard'
- task: PublishSecurityAnalysisLogs@2
displayName: Security - Publish Scan Results
inputs:
ArtifactName: 'CodeAnalysisLogs'
ArtifactType: 'Container'
AllTools: true
ToolLogsNotFoundAction: 'Standard'
- task: TSAUpload@1
inputs:
tsaVersion: 'TsaV2'
codebase: 'Existing'
tsaEnvironment: 'PROD'
codeBaseName: 'Docs_Mdoc'
uploadBinSkim: true
uploadCredScan: true
uploadAsync: true
- task: PostAnalysis@1
displayName: Security - PostAnalysis
inputs:
AllTools: false
CredScan: true
BinSkim: true
ToolLogsNotFoundAction: 'Standard'
- task: ComponentGovernanceComponentDetection@0
inputs:
scanType: 'Register'
verbosity: 'Verbose'
alertWarningLevel: 'High'
- stage: Build
dependsOn: SDLCheck
jobs:
- job: Build
pool:
vmImage: 'macos-latest'
steps:
- task: NuGetToolInstaller@1
displayName: Install NuGet Tool
- task: UseDotNet@2
displayName: 'Use .NET Core sdk'
inputs:
packageType: sdk
version: 2.1.x
installationPath: $(Agent.ToolsDirectory)/dotnet
- task: UseDotNet@2
displayName: 'Use .NET 6.0.x'
inputs:
packageType: sdk
version: 6.0.x
installationPath: $(Agent.ToolsDirectory)/dotnet
- task: Bash@3
displayName: Run Unit and Integration Tests
inputs:
targetType: 'inline'
script: 'make prepare clean all check CONFIGURATION=$(buildConfiguration)'
- task: EsrpCodeSigning@1
displayName: Sign executable and dll files
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
inputs:
ConnectedServiceName: 'CodeSigning-APEX'
FolderPath: '$(mdocPath)'
UseMinimatch: true
signConfigType: inlineSignParams
SessionTimeout: '60'
MaxConcurrency: '100'
MaxRetryAttempts: '5'
Pattern: |
*.dll
*.exe
inlineOperation: |
[
{
"KeyCode": "CP-230012",
"OperationSetCode": "SigntoolSign",
"parameters": [
{
"parameterName": "OpusName",
"parameterValue": "Microsoft"
},
{
"parameterName": "OpusInfo",
"parameterValue": "http://www.microsoft.com"
},
{
"parameterName": "PageHash",
"parameterValue": "/NPH"
},
{
"parameterName": "TimeStamp",
"parameterValue": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256"
},
{
"parameterName": "FileDigest",
"parameterValue": "/fd \"SHA256\""
}
],
"ToolName": "sign",
"ToolVersion": "1.0"
},
{
"KeyCode": "CP-230012",
"OperationSetCode": "SigntoolVerify",
"Parameters": [
{
"parameterName": "VerifyAll",
"parameterValue": "/all"
}
],
"ToolName": "sign",
"ToolVersion": "1.0"
}
]
- task: ArchiveFiles@2
displayName: Archive mdoc Files
inputs:
rootFolderOrFile: '$(mdocPath)'
includeRootFolder: false
archiveType: 'zip'
archiveFile: '$(Build.ArtifactStagingDirectory)/zips/mdoc-$(Build.BuildNumber).zip'
replaceExistingArchive: true
- task: PublishBuildArtifacts@1
displayName: 'Publish mdoc Artifact'
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)/zips'
ArtifactName: 'mdoc.Artifact'
- task: PowerShell@2
name: 'mdocVersion'
displayName: 'Checking remote and local version of mdoc'
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
inputs:
filePath: 'mdoc/CheckNugetPublish.ps1'
- task: NuGetCommand@2
displayName: 'Create a NuGet package for mdoc'
condition: eq(variables['mdocVersion.NeedUpdate'], true)
inputs:
command: 'pack'
packagesToPack: 'mdoc/mdoc.nuspec'
- task: EsrpCodeSigning@1
displayName: 'Sign NuGet packages'
condition: eq(variables['mdocVersion.NeedUpdate'], true)
inputs:
ConnectedServiceName: 'CodeSigning-APEX'
FolderPath: '$(Build.ArtifactStagingDirectory)'
Pattern: '*.nupkg'
signConfigType: inlineSignParams
inlineOperation: |
[
{
"KeyCode" : "CP-401405",
"OperationSetCode" : "NuGetSign",
"Parameters" : [
{
"parameterName": "TimeStamp",
"parameterValue": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256"
},
{
"parameterName": "FileDigest",
"parameterValue": "/fd \"SHA256\""
}
],
"ToolName" : "sign",
"ToolVersion" : "1.0"
},
{
"KeyCode" : "CP-401405",
"OperationSetCode" : "NuGetVerify",
"Parameters" : [],
"ToolName" : "sign",
"ToolVersion" : "1.0"
}
]
SessionTimeout: 20
# - task: NuGetCommand@2
# displayName: 'Publishing mdoc package to nuget.org'
# condition: eq(variables['mdocVersion.NeedUpdate'], true)
# inputs:
# command: 'push'
# packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg'
# nuGetFeedType: 'external'
# publishFeedCredentials: 'mdoc_nuget_org'