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

Добавил параметр useBranchPlugin

This commit is contained in:
ivanovEV 2022-04-08 15:05:14 +03:00
parent e1741f5078
commit 7312b7e75a
4 changed files with 15 additions and 2 deletions

View File

@ -43,7 +43,8 @@
"sonarQubeInstallation": "",
"useSonarScannerFromPath": true,
"sonarScannerToolName": "sonar-scanner",
"infoBaseUpdateModuleName" : ""
"infoBaseUpdateModuleName" : "",
"useBranchPlugin" : true
},
"syntaxCheck": {
"groupErrorsByMetadata": true,

View File

@ -173,6 +173,10 @@
"infoBaseUpdateModuleName" : {
"type" : "string",
"description" : "Имя общего модуля (например, ОбновлениеИнформационнойБазыXXX), в котором указана версия библиотеки.\n Версия должна задаваться в виде присвоения `Описание.Версия = \"ваш номер версии\";`\n "
},
"useBranchPlugin" : {
"type" : "boolean",
"description" : "Используется ли Branch-plugin в SonarQube"
}
}
},

View File

@ -25,6 +25,9 @@ class SonarQubeOptions implements Serializable {
""")
String infoBaseUpdateModuleName
@JsonPropertyDescription("Используется ли Branch-plugin в SonarQube")
Boolean useBranchPlugin
@Override
@NonCPS
String toString() {
@ -33,6 +36,7 @@ class SonarQubeOptions implements Serializable {
", sonarScannerToolName='" + sonarScannerToolName + '\'' +
", sonarQubeInstallation='" + sonarQubeInstallation + '\'' +
", infoBaseUpdateModuleName='" + infoBaseUpdateModuleName + '\'' +
", useBranchPlugin='" + useBranchPlugin + '\'' +
'}';
}
}

View File

@ -36,7 +36,11 @@ class SonarScanner implements Serializable {
sonarScannerBinary = "$scannerHome/bin/sonar-scanner"
}
String sonarCommand = "$sonarScannerBinary -Dsonar.branch.name=$env.BRANCH_NAME"
String sonarCommand = "$sonarScannerBinary"
if (config.sonarQubeOptions.useBranchPlugin) {
sonarCommand += " -Dsonar.branch.name=$env.BRANCH_NAME"
}
String projectVersion = computeProjectVersion()
if (projectVersion) {