forked from SonarSource/sonar-scanner-msbuild
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
496 lines (472 loc) · 22 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
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
# SonarScanner for MSBuild
# Build, QA, Deploy
schedules:
# Run from Monday to Friday at 2:0 UTC (https://docs.microsoft.com/en-us/azure/devops/pipelines/process/scheduled-triggers?view=azure-devops&tabs=yaml#cron-syntax)
- cron: "0 2 * * 1-5"
displayName: Nightly build
branches:
include:
- master
always: true
trigger:
- master
pool:
vmImage: 'windows-latest'
variables:
- group: sonarsource-build-variables
- group: sonar-scanner-dotnet-variables
resources:
repositories:
- repository: commonTemplates
type: git
name: pipelines-yaml-templates
ref: refs/tags/v1.0.11
stages:
- template: stage-with-burgr-notifications.yml@commonTemplates
parameters:
burgrName: 'build'
burgrType: 'build'
stageName: 'build'
stageDisplayName: 'Build:'
jobs:
- job: build
displayName: 'Build, UT, analyze on SonarCloud and stage to repox'
workspace:
clean: all
variables:
solution: 'SonarScanner.MSBuild.sln'
tfsProcessorSolution: 'SonarScanner.MSBuild.TFS.sln'
sonarCloudOrganization: 'sonarsource'
sonarCloudMsBuildProjectKey: 'sonarscanner-msbuild'
sonarCloudMsBuildProjectName: 'SonarScanner for MSBuild'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
MAVEN_CACHE_FOLDER: $(Pipeline.Workspace)/.m2/repository
MAVEN_OPTS: '-Xmx3072m -Dmaven.repo.local=$(MAVEN_CACHE_FOLDER)'
commonMavenArguments: -B -Pdeploy-sonarsource -Dmaven.test.skip=true
steps:
- checkout: self
- task: NuGetToolInstaller@1
displayName: 'Use NuGet 5.7.0'
inputs:
versionSpec: '5.7.0'
- task: CacheBeta@0
enabled: true
displayName: Cache Maven local repo
inputs:
key: maven | pom.xml
path: $(MAVEN_CACHE_FOLDER)
- task: DownloadSecureFile@1
name: snk
inputs:
secureFile: 'SonarSourceSecret.snk'
displayName: 'Download snk'
- task: DownloadSecureFile@1
displayName: 'Download pfx'
name: pfx
inputs:
secureFile: 'SonarSource-2021-2023.pfx'
- task: PowerShell@2
displayName: 'Promote project version'
inputs:
targetType: 'inline'
script: |
# Calculate the file path
$versionFilePath = "$env:BUILD_SOURCESDIRECTORY\scripts\version\Version.props"
Write-Host "Reading the Sonar project version from '${versionFilePath}' ..."
# Read the version from the file
[xml]$versionProps = Get-Content "$versionFilePath"
$sonarProjectVersion = $versionProps.Project.PropertyGroup.MainVersion
Write-Host "Sonar project version is '${sonarProjectVersion}'"
# Set the variable to it can be used by other tasks
Write-Host "##vso[task.setvariable variable=SONAR_PROJECT_VERSION]$sonarProjectVersion"
- task: VSBuild@1
displayName: 'Set BranchName, Sha1 and BuildNumber properties from Azdo pipeline variables'
inputs:
solution: 'scripts\version\ChangeVersion.proj'
msbuildArgs: '/p:Sha1=$(Build.SourceVersion) /p:BranchName=$(Build.SourceBranchName) /p:BuildNumber=$(Build.BuildId) /p:BuildConfiguration=$(BuildConfiguration)'
- task: SonarCloudPrepare@1
displayName: 'Prepare analysis on SonarCloud'
inputs:
SonarCloud: 'SonarCloud'
organization: '$(sonarCloudOrganization)'
projectKey: '$(sonarCloudMsBuildProjectKey)'
projectName: '$(sonarCloudMsBuildProjectName)'
projectVersion: '$(SONAR_PROJECT_VERSION)'
scannerMode: MSBuild
- task: DotNetCoreCLI@2
displayName: Dotnet restore $(tfsProcessorSolution)
inputs:
command: 'restore'
projects: '$(tfsProcessorSolution)'
feedsToUse: 'select'
verbosityRestore: 'normal' # Default is noisy 'Detailed'
- task: NuGetCommand@2
displayName: 'NuGet restore TFS Processor'
inputs:
command: 'restore'
restoreSolution: '$(tfsProcessorSolution)'
feedsToUse: 'select'
- task: DotNetCoreCLI@2
env:
SignAssembly: 'true'
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
displayName: 'Build and prepare signing $(tfsProcessorSolution)'
inputs:
command: 'build'
projects: '$(tfsProcessorSolution)'
arguments: '/m /p:DeployExtension=false /p:platform="$(BuildPlatform)" /p:configuration=$(BuildConfiguration) /p:ZipPackageCompressionLevel=normal /p:AssemblyOriginatorKeyFile="$(snk.secureFilePath)"'
- task: DotNetCoreCLI@2
condition: and(succeeded(), ne(variables['Build.SourceBranch'], 'refs/heads/master'))
displayName: 'Build $(tfsProcessorSolution)'
inputs:
command: 'build'
projects: '$(tfsProcessorSolution)'
arguments: '/m /p:DeployExtension=false /p:platform="$(BuildPlatform)" /p:configuration=$(BuildConfiguration) /p:ZipPackageCompressionLevel=normal'
- task: UseDotNet@2
inputs:
packageType: sdk
version: 5.0.100
installationPath: $(Agent.ToolsDirectory)/dotnet
displayName: "Use .NET 5 SDK"
- task: NuGetCommand@2
displayName: 'NuGet restore $(solution)'
inputs:
command: 'restore'
restoreSolution: '$(solution)'
feedsToUse: 'select'
- task: DotNetCoreCLI@2
displayName: Dotnet restore $(solution)
inputs:
command: 'restore'
projects: '$(solution)'
feedsToUse: 'select'
verbosityRestore: 'normal' # Default is noisy 'Detailed'
- task: DotNetCoreCLI@2
env:
SignAssembly: 'true'
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
displayName: 'Build and prepare signing $(solution)'
inputs:
command: 'build'
projects: '$(solution)'
arguments: '/m /p:DeployExtension=false /p:ZipPackageCompressionLevel=normal /p:configuration=$(BuildConfiguration) /p:platform="$(BuildPlatform)" /p:AssemblyOriginatorKeyFile="$(snk.secureFilePath)"'
- task: DotNetCoreCLI@2
condition: and(succeeded(), ne(variables['Build.SourceBranch'], 'refs/heads/master'))
displayName: 'Build $(solution)'
inputs:
command: 'build'
projects: '$(solution)'
arguments: '/m /p:DeployExtension=false /p:ZipPackageCompressionLevel=normal /p:configuration=$(BuildConfiguration) /p:platform="$(BuildPlatform)"'
- task: VSTest@2
displayName: 'Run Unit Tests'
inputs:
testSelector: 'testAssemblies'
testAssemblyVer2: |
**\$(BuildConfiguration)\*\SonarScanner.MsBuild.*Test.dll
!**\obj\**
searchFolder: '$(System.DefaultWorkingDirectory)'
codeCoverageEnabled: true
- task: PowerShell@2
displayName: 'Delete files created by unit tests'
inputs:
targetType: 'inline'
script: |
Get-ChildItem $(Agent.TempDirectory) -Filter 'dummy.*' -Recurse -Attributes !Directory | Remove-Item
Get-ChildItem $(Agent.TempDirectory) -Filter 'VSCodeCoverageReport.*' -Recurse -Attributes !Directory | Remove-Item
- task: SonarCloudAnalyze@1
displayName: 'Run SonarCloud analysis'
- task: PowerShell@2
displayName: 'Package scanner files'
inputs:
targetType: 'inline'
script: |
. (Join-Path "scripts" "package-artifacts.ps1")
. (Join-Path "scripts" "variables.ps1")
Download-ScannerCli
Package-Net46Scanner
Package-NetScanner "netcoreapp3.1" "netcoreapp3.0"
Package-NetScanner "netcoreapp2.1" "netcoreapp2.0"
Package-NetScanner "net5.0" "net5.0"
pwsh: true
- powershell: .\scripts\whitesource\WhiteSource-Scan.ps1
condition: eq(variables['Build.SourceBranch'], 'refs/heads/master')
env:
JAVA_HOME_11_X64: '$(JAVA_HOME_11_X64)'
WS_PRODUCTNAME: '$(WHITESOURCE_PRODUCTNAME)'
WS_APIKEY: '$(WHITESOURCE_APIKEY)'
displayName: "WhiteSource scan"
- task: PowerShell@2
displayName: Sign assemblies
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
env:
SIGNTOOL_PATH: 'C:\\Program Files (x86)\\Windows Kits\\10\\bin\\10.0.17763.0\\x64\\signtool.exe'
PFX_PASSWORD: $(pfxPassword2021-2023)
PFX_SHA1: $(pfxSha1-2021-2023)
PFX_PATH: $(pfx.secureFilePath)
inputs:
filePath: 'scripts\sign.ps1'
pwsh: true
- task: NuGetCommand@2
displayName: 'Package dotnet global tool'
inputs:
command: 'pack'
packagesToPack: 'nuspec\netcoreglobaltool\dotnet-sonarscanner.nuspec'
packDestination: 'build'
versioningScheme: 'off'
- task: NuGetCommand@2
displayName: "Sign NuGet packages"
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
inputs:
command: 'custom'
arguments: 'sign $(Build.SourcesDirectory)\build\dotnet-sonarscanner*.nupkg -CertificatePath $(pfx.secureFilePath) -CertificatePassword $(pfxPassword2021-2023) -Timestamper http://sha256timestamp.ws.symantec.com/sha256/timestamp'
- task: PowerShell@2
displayName: 'Write project version in file'
inputs:
targetType: 'inline'
script: |
Add-Content build/version.txt $(SONAR_PROJECT_VERSION)
- task: DownloadSecureFile@1
displayName: 'Download Maven settings'
name: mavenSettings
inputs:
secureFile: 'maven-settings.xml'
- task: PowerShell@2
displayName: 'Generate packages'
inputs:
targetType: 'inline'
script: |
[xml]$versionProps = Get-Content "$env:BUILD_SOURCESDIRECTORY\scripts\version\Version.props"
$leakPeriodVersion = $versionProps.Project.PropertyGroup.MainVersion
$artifactsFolder = "$env:BUILD_SOURCESDIRECTORY\\build"
$version = $leakPeriodVersion + '.' + $env:BUILD_BUILDID
$classicScannerZipPath = Get-Item "$artifactsFolder\\sonarscanner-msbuild-net46.zip"
$dotnetScannerZipPath = Get-Item "$artifactsFolder\\sonarscanner-msbuild-netcoreapp2.0.zip"
$dotnetScannerZipPath3 = Get-Item "$artifactsFolder\\sonarscanner-msbuild-netcoreapp3.0.zip"
$dotnetScannerZipPath5 = Get-Item "$artifactsFolder\\sonarscanner-msbuild-net5.0.zip"
$dotnetScannerGlobalToolPath = Get-Item "$artifactsFolder\\dotnet-sonarscanner.$leakPeriodVersion.nupkg"
Write-Host "Generating the chocolatey packages"
$classicZipHash = (Get-FileHash $classicScannerZipPath -Algorithm SHA256).hash
$net46ps1 = "nuspec\chocolatey\chocolateyInstall-net46.ps1"
(Get-Content $net46ps1) `
-Replace '-Checksum "not-set"', "-Checksum $classicZipHash" `
-Replace "__PackageVersion__", "$version" `
| Set-Content $net46ps1
$dotnetZipHash = (Get-FileHash $dotnetScannerZipPath -Algorithm SHA256).hash
$netcoreps1 = "nuspec\chocolatey\chocolateyInstall-netcoreapp2.0.ps1"
(Get-Content $netcoreps1) `
-Replace '-Checksum "not-set"', "-Checksum $dotnetZipHash" `
-Replace "__PackageVersion__", "$version" `
| Set-Content $netcoreps1
$dotnetZipHash3 = (Get-FileHash $dotnetScannerZipPath3 -Algorithm SHA256).hash
$netcoreps13 = "nuspec\chocolatey\chocolateyInstall-netcoreapp3.0.ps1"
(Get-Content $netcoreps13) `
-Replace '-Checksum "not-set"', "-Checksum $dotnetZipHash3" `
-Replace "__PackageVersion__", "$version" `
| Set-Content $netcoreps13
$dotnetZipHash5 = (Get-FileHash $dotnetScannerZipPath5 -Algorithm SHA256).hash
$netcoreps15 = "nuspec\chocolatey\chocolateyInstall-net5.0.ps1"
(Get-Content $netcoreps15) `
-Replace '-Checksum "not-set"', "-Checksum $dotnetZipHash5" `
-Replace "__PackageVersion__", "$version" `
| Set-Content $netcoreps15
choco pack nuspec\chocolatey\sonarscanner-msbuild-net46.nuspec `
--outputdirectory $artifactsFolder `
--version $version
choco pack nuspec\chocolatey\sonarscanner-msbuild-netcoreapp2.0.nuspec `
--outputdirectory $artifactsFolder `
--version $version
choco pack nuspec\chocolatey\sonarscanner-msbuild-netcoreapp3.0.nuspec `
--outputdirectory $artifactsFolder `
--version $version
choco pack nuspec\chocolatey\sonarscanner-msbuild-net5.0.nuspec `
--outputdirectory $artifactsFolder `
--version $version
Write-Host "Update artifacts locations in pom.xml"
$pomFile = ".\pom.xml"
(Get-Content $pomFile) `
-Replace 'classicScannerZipPath', "$classicScannerZipPath" `
-Replace 'dotnetScannerZipPath', "$dotnetScannerZipPath" `
-Replace 'dotnet3ScannerZipPath', "$dotnetScannerZipPath3" `
-Replace 'dotnet5ScannerZipPath', "$dotnetScannerZipPath5" `
-Replace 'dotnetScannerGlobalToolPath', "$dotnetScannerGlobalToolPath" `
-Replace 'classicScannerChocoPath', "$artifactsFolder\\sonarscanner-msbuild-net46.$version.nupkg" `
-Replace 'dotnetcore2ScannerChocoPath', "$artifactsFolder\\sonarscanner-msbuild-netcoreapp2.0.$version.nupkg" `
-Replace 'dotnetcore3ScannerChocoPath', "$artifactsFolder\\sonarscanner-msbuild-netcoreapp30.$version.nupkg" `
-Replace 'dotnet5ScannerChocoPath', "$artifactsFolder\\sonarscanner-msbuild-net50.$version.nupkg" `
| Set-Content $pomFile
- task: Maven@3
displayName: Promote new version in pom
inputs:
mavenPomFile: 'pom.xml'
goals: 'org.codehaus.mojo:versions-maven-plugin:2.2:set'
options: >-
$(commonMavenArguments)
-DnewVersion=$(SONAR_PROJECT_VERSION).$(Build.BuildId)
--settings $(mavenSettings.secureFilePath)
-DgenerateBackupPoms=false -e
javaHomeOption: 'JDKVersion'
mavenVersionOption: 'Default'
jdkVersionOption: '1.11'
mavenOptions: $(MAVEN_OPTS)
- task: Maven@3
displayName: 'Stage to repox'
env:
PROJECT_VERSION: $(SONAR_PROJECT_VERSION)
BUILD_ID: $(Build.BuildId)
ARTIFACTORY_DEPLOY_USERNAME: $(ARTIFACTORY_DEPLOY_USERNAME)
ARTIFACTORY_DEPLOY_PASSWORD: $(ARTIFACTORY_DEPLOY_PASSWORD)
inputs:
goals: 'deploy'
options: >-
$(commonMavenArguments)
--settings $(mavenSettings.secureFilePath)
-Pdeploy-sonarsource -e -V
publishJUnitResults: false
javaHomeOption: 'JDKVersion'
jdkVersionOption: '1.11'
mavenOptions: $(MAVEN_OPTS)
- task: PowerShell@2
displayName: "Rename artifacts for GitHub Release"
inputs:
targetType: 'inline'
script: |
$artifactsFolder = "$env:BUILD_SOURCESDIRECTORY\\build"
Rename-Item -Path "$artifactsFolder\\sonarscanner-msbuild-net46.zip" -NewName sonar-scanner-msbuild-$(SONAR_PROJECT_VERSION).$(Build.BuildId)-net46.zip
Rename-Item -Path "$artifactsFolder\\sonarscanner-msbuild-netcoreapp2.0.zip" -NewName sonar-scanner-msbuild-$(SONAR_PROJECT_VERSION).$(Build.BuildId)-netcoreapp2.0.zip
Rename-Item -Path "$artifactsFolder\\sonarscanner-msbuild-netcoreapp3.0.zip" -NewName sonar-scanner-msbuild-$(SONAR_PROJECT_VERSION).$(Build.BuildId)-netcoreapp3.0.zip
Rename-Item -Path "$artifactsFolder\\sonarscanner-msbuild-net5.0.zip" -NewName sonar-scanner-msbuild-$(SONAR_PROJECT_VERSION).$(Build.BuildId)-net5.0.zip
- task: PowerShell@2
displayName: "Copy documentation file"
inputs:
targetType: 'inline'
script: |
Copy-Item "sonar-docs\\analysis\\scan\\sonarscanner-for-msbuild.md" -Destination "build"
- task: PublishPipelineArtifact@1
displayName: 'Publish packages as artifacts'
inputs:
targetPath: 'build'
artifact: 'scanner-packages'
- task: CmdLine@2
displayName: Revert changes made to pom.xml to not break cache feature
inputs:
script: 'git checkout .'
- template: stage-with-burgr-notifications.yml@commonTemplates
parameters:
burgrName: 'qa'
burgrType: 'qa'
stageName: 'qa'
stageDisplayName: 'QA:'
stageDependencies:
- build
jobs:
- job: its
displayName: 'Run ITs'
strategy:
matrix:
vs2017_latest89:
SQ_VERSION: "LATEST_RELEASE[8.9]"
SONAR_CFAMILYPLUGIN_VERSION: "LATEST_RELEASE"
SONAR_CSHARPPLUGIN_VERSION: "LATEST_RELEASE"
SONAR_VBNETPLUGIN_VERSION: "LATEST_RELEASE"
MSBUILD_PATH: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\MSBuild\\15.0\\Bin\\MSBuild.exe"
PLATFORMTOOLSET: "v140"
WINDOWSSDKTARGET: "10.0.17763.0"
vs2019_latest79:
SQ_VERSION: "LATEST_RELEASE[7.9]"
SONAR_CFAMILYPLUGIN_VERSION: "LATEST_RELEASE"
SONAR_CSHARPPLUGIN_VERSION: "LATEST_RELEASE"
SONAR_VBNETPLUGIN_VERSION: "LATEST_RELEASE"
MSBUILD_PATH: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\MSBuild\\Current\\Bin\\MSBuild.exe"
PLATFORMTOOLSET: "v140"
WINDOWSSDKTARGET: "10.0.17763.0"
vs2022_latest89:
SQ_VERSION: "LATEST_RELEASE[8.9]"
SONAR_CFAMILYPLUGIN_VERSION: "LATEST_RELEASE"
SONAR_CSHARPPLUGIN_VERSION: "LATEST_RELEASE"
SONAR_VBNETPLUGIN_VERSION: "LATEST_RELEASE"
MSBUILD_PATH: "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Current\\Bin\\MSBuild.exe"
PLATFORMTOOLSET: "v140"
WINDOWSSDKTARGET: "10.0.17763.0"
vs2022_dev:
SQ_VERSION: "DEV"
SONAR_CFAMILYPLUGIN_VERSION: "LATEST_RELEASE"
SONAR_CSHARPPLUGIN_VERSION: "LATEST_RELEASE"
SONAR_VBNETPLUGIN_VERSION: "LATEST_RELEASE"
MSBUILD_PATH: "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Current\\Bin\\MSBuild.exe"
PLATFORMTOOLSET: "v140"
WINDOWSSDKTARGET: "10.0.17763.0"
variables:
MAVEN_CACHE_FOLDER: $(Pipeline.Workspace)/.m2/repository
MAVEN_OPTS: '-Xmx3072m -Dmaven.repo.local=$(MAVEN_CACHE_FOLDER)'
pool: '.Net Bubble - GCP'
steps:
- checkout: self
fetchDepth: 1
- task: CacheBeta@0
displayName: Cache Maven local repo
inputs:
key: maven | its/pom.xml
path: $(MAVEN_CACHE_FOLDER)
- task: DownloadSecureFile@1
displayName: 'Download maven settings'
name: mavenSettings
inputs:
secureFile: 'maven-settings.xml'
- task: DownloadPipelineArtifact@2
inputs:
buildType: 'current'
itemPattern: |
*.zip
version.txt
targetPath: '$(Pipeline.Workspace)\\scanner-packages'
artifactName: scanner-packages
## This JDK11 task uses hardcoded java version that is
## - downloaded from github release for VS image 2015 (because JDK8 is installed by default, and we need 11+ to run DEV / LTS7.9+)
## - Defined as per the java version installed and not used by default for VS2017 image (see : https://github.com/Microsoft/azure-pipelines-image-generation/blob/master/images/win/Vs2017-Server2016-Readme.md)
- task: PowerShell@2
displayName: "Write JDK11 path to JDK_PATH"
inputs:
targetType: 'inline'
script: |
Write-Host "##vso[task.setvariable variable=JDK_PATH]$JAVA_HOME_11_X64"
- task: NuGetToolInstaller@1
inputs:
versionSpec: '5.8.0'
- task: PowerShell@2
displayName: "Get version from artifact file"
inputs:
targetType: 'inline'
script: |
$projectVersion = Get-Content "$(Pipeline.Workspace)\\scanner-packages\\version.txt"
Write-Host "##vso[task.setvariable variable=SONAR_PROJECT_VERSION]$projectVersion"
- task: Maven@3
displayName: 'Run Maven ITs for SQ $(SQ_VERSION)'
env:
ARTIFACTORY_QA_READER_USERNAME: $(ARTIFACTORY_QA_READER_USERNAME)
ARTIFACTORY_QA_READER_PASSWORD: $(ARTIFACTORY_QA_READER_PASSWORD)
# For Orchestrator
ARTIFACTORY_API_KEY: $(ARTIFACTORY_API_KEY)
GITHUB_TOKEN: $(GITHUB_TOKEN)
MAVEN_LOCAL_REPOSITORY: $(MAVEN_CACHE_FOLDER)
NUGET_PATH: $(NUGETEXETOOLPATH)
inputs:
goals: 'verify'
options: --settings $(mavenSettings.secureFilePath) -B -e -Denable-repo=qa -Dsonar.cfamilyplugin.version=$(SONAR_CFAMILYPLUGIN_VERSION) -Dsonar.csharpplugin.version=$(SONAR_CSHARPPLUGIN_VERSION) -Dsonar.vbnetplugin.version=$(SONAR_VBNETPLUGIN_VERSION) -Dsonar.runtimeVersion=$(SQ_VERSION) -DscannerForMSBuild.version=$(SONAR_PROJECT_VERSION).$(Build.BuildId) -Dmsbuild.path="$(MSBUILD_PATH)" -Dmsbuild.plateformtoolset=$(PLATFORMTOOLSET) -Dmsbuild.windowssdk=$(WINDOWSSDKTARGET)
publishJUnitResults: true
mavenPomFile: 'its/pom.xml'
testResultsFiles: '**/surefire-reports/TEST-*.xml'
testRunTitle: 'ITs $(SQ_VERSION)'
javaHomeOption: 'Path'
jdkDirectory: $(JAVA_HOME_11_X64)
mavenOptions: $(MAVEN_OPTS)
mavenVersionOption: 'Default'
- bash: git checkout .
name: revertPomChanges
displayName: Revert changes made to pom.xml to not break cache feature
- template: promote-stage.yml@commonTemplates
parameters:
stageName: 'Artifacts:'
stageDependencies:
- build
- qa