File tree Expand file tree Collapse file tree 3 files changed +40
-38
lines changed Expand file tree Collapse file tree 3 files changed +40
-38
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -99,6 +99,25 @@ pipeline {
99
99
}
100
100
}
101
101
}
102
+ stage (' Analyze' ) {
103
+ when {
104
+ anyOf {
105
+ changeRequest()
106
+ branch " main"
107
+ }
108
+ }
109
+ tools {
110
+ maven ' maven-3.6.0'
111
+ jdk ' jdk11'
112
+ }
113
+ steps {
114
+ withSonarQubeEnv(' SonarCloud' ) {
115
+ withCredentials([string(credentialsId : ' encj_github_token' , variable : ' GITHUB_TOKEN' )]) {
116
+ runSonarScanner()
117
+ }
118
+ }
119
+ }
120
+ }
102
121
stage (' Save Nightly Installer' ){
103
122
when {
104
123
allOf {
@@ -113,4 +132,23 @@ pipeline {
113
132
}
114
133
}
115
134
}
116
- }
135
+ }
136
+
137
+ void runSonarScanner () {
138
+ def changeUrl = env. GIT_URL . split(" /" )
139
+ def org = changeUrl[3 ]
140
+ def repo = changeUrl[4 ]. substring(0 , changeUrl[4 ]. length() - 4 )
141
+ if (env. CHANGE_ID != null ) {
142
+ sh " mvn -B sonar:sonar \
143
+ -Dsonar.projectKey=${ org} _${ repo} \
144
+ -Dsonar.pullrequest.provider=GitHub \
145
+ -Dsonar.pullrequest.github.repository=${ org} /${ repo} \
146
+ -Dsonar.pullrequest.key=${ env.CHANGE_ID} \
147
+ -Dsonar.pullrequest.branch=${ env.CHANGE_BRANCH} \
148
+ -Dsonar.pullrequest.base=${ env.CHANGE_TARGET} "
149
+ } else {
150
+ sh " mvn -B sonar:sonar \
151
+ -Dsonar.projectKey=${ org} _${ repo} \
152
+ -Dsonar.branch.name=${ env.BRANCH_NAME} "
153
+ }
154
+ }
Original file line number Diff line number Diff line change 260
260
<plugin >
261
261
<groupId >org.jacoco</groupId >
262
262
<artifactId >jacoco-maven-plugin</artifactId >
263
- <version >0.8.5 </version >
263
+ <version >0.8.7 </version >
264
264
</plugin >
265
265
<plugin >
266
266
<groupId >org.sonarsource.scanner.maven</groupId >
You can’t perform that action at this time.
0 commit comments