1
0
mirror of https://github.com/firstBitMarksistskaya/jenkins-lib.git synced 2024-12-04 10:34:42 +02:00

Добавил возможность использовать МР при использовании gitlab-branch-source-plugin

This commit is contained in:
ivanovEV 2022-04-25 15:39:31 +03:00 committed by Nikita Fedkin
parent b690f544f5
commit d75ce1a79f
No known key found for this signature in database
GPG Key ID: E7AE91471C6FFE04

View File

@ -39,7 +39,13 @@ class SonarScanner implements Serializable {
String sonarCommand = "$sonarScannerBinary"
if (config.sonarQubeOptions.useBranchPlugin) {
sonarCommand += " -Dsonar.branch.name=$env.BRANCH_NAME"
if ($env.CHANGE_ID){
sonarCommand += " -Dsonar.pullrequest.key=$env.CHANGE_ID"
sonarCommand += " -Dsonar.pullrequest.branch=$env.CHANGE_BRANCH"
sonarCommand += " -Dsonar.pullrequest.base=$env.CHANGE_TARGET"
} else {
sonarCommand += " -Dsonar.branch.name=$env.BRANCH_NAME"
}
}
String projectVersion = computeProjectVersion()