After upgrade from 7.7 to 8.8: sonar.branch.name and sonar.branch.target
I have upgraded SonarQube Developer Edition from 7.7 to 8.8 (7.7 → 7.9 LTS → 8.8).
This is my Maven command to start a SonarQube analysis:
mvn --no-transfer-progress \
--global-settings /home/ubuntu/jenkins/workspace/foobar@tmp/config12345tmp \
-Dmaven.repo.local=/home/ubuntu/jenkins/workspace/foobar/.repository \
org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar \
-Dsonar.branch.name=7.2/null_test \
-Dsonar.branch.target=7.2.0_preparations
I have now defined New Code manually by going into the configuration of each individual project:
-
master
: Previous Version -
develop
: Reference branchmaster
-
7.2.0_preparations
: Specific Analysis - All
7.2/*
branches: Reference branch7.2.0_preparations
- All other branches: Reference branch
develop
This was a very tedious work. It will have to be done again for every new project. It will have to be done again for every new 7.2/*
branch.
Does there exist some analysis parameter that I can use, to define what the New Code is?
Something like this (pseudocode)
mvn sonar:sonar \
-Dsonar.branch.name=master \
-Dsonar.newcode=previousVersion
mvn sonar:sonar \
-Dsonar.branch.name=develop \
-Dsonar.newcode=referenceBranch \
-Dsonar.newcode.referenceBranch=master
mvn sonar:sonar \
-Dsonar.branch.name=7.2.0_preparations \
-Dsonar.newcode=specificAnalysis \
-Dsonar.newcode.specificAnalysis=foobar
mvn sonar:sonar \
-Dsonar.branch.name=7.2/null_test \
-Dsonar.newcode=referenceBranch \
-Dsonar.newcode.referenceBranch=7.2.0_preparations
mvn sonar:sonar \
-Dsonar.branch.name=myAwesomeFeatureBranch \
-Dsonar.newcode=referenceBranch \
-Dsonar.newcode.referenceBranch=develop
I could then set all those parameters in a branch dependent Jenkins pipeline.