-
Notifications
You must be signed in to change notification settings - Fork 29
/
sonarCloud-pipeline.yml
68 lines (59 loc) · 1.8 KB
/
sonarCloud-pipeline.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
trigger: none
pr: none
pool:
vmImage: 'windows-latest'
variables:
- group: SecureVariables
- name: solution
value: "**/*.sln"
- name: buildPlatform
value: "Any CPU"
- name: buildConfiguration
value: "Release"
stages:
- stage: QualityCheckStage
displayName: Quality Check Stage
jobs:
- job: SonarCloudJob
displayName: "Sonar Cloud Job"
steps:
- task: UseDotNet@2
displayName: "Use .NET Core 7.0"
inputs:
packageType: "sdk"
version: "7.0.x"
- task: DotNetCoreCLI@2
displayName: Restore
inputs:
command: "restore"
projects: "Application-Source-Code/**/*.csproj"
# feedsToUse: "config"
# nugetConfigPath: "**/*NuGet.config"
- task: SonarCloudPrepare@1
displayName: 'Prepare analysis on SonarCloud'
inputs:
SonarCloud: 'SonarCloud-DevSecOps'
organization: $(SonarCloud-OrgKey)
scannerMode: 'MSBuild'
projectKey: $(SonarCloud-ProjectKey)
projectName: 'DevSecOps'
extraProperties: |
sonar.exclusions=**/obj/**,**/*.dll
sonar.cs.opencover.reportsPaths=$(Build.SourcesDirectory)/**/coverage.opencover.xml
sonar.cs.vstest.reportsPaths=$(Agent.TempDirectory)/*.trx
- task: DotNetCoreCLI@2
displayName: Build
inputs:
projects: "Application-Source-Code/**/*.csproj"
arguments: "--configuration $(BuildConfiguration)"
- task: SonarCloudAnalyze@1
displayName: "Run scanner and upload results to SonarCloud"
- task: SonarCloudPublish@1
displayName: Publish Sonar Cloud Results
inputs:
pollingTimeoutSec: '300'
- task: sonarcloud-buildbreaker@2
displayName: SonarCloud Break Build
inputs:
SonarCloud: 'SonarCloud-DevSecOps'
organization: $(SonarCloud-OrgKey)