I need some help to calculate new code for a branch where baseline is a tag.
Must-share information (formatted with Markdown):
- which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
SonarQube Developer Edition Version 8.6.1 (build 40680) (On premises)
sonarsource/sonar-scanner-cli:latest Using docker image sha256:497d58079641d52a72898b32a885f35ee75ca6a048e458678bd36664c0ada366
gitlab CI to trigger sonar-scanner
- what are you trying to achieve
I am trying to set a tag as baseline version in a project in sonarqube to get New Code details compared between latest sha in the branch against a tag.
- what have you tried so far to achieve this
Analyzed the branch using gitlab CI → project branch is created with branch “br1”
Analyzed the tag using gitlab CI → another project branch created with “v0.1”
In project settings set baseline for branch “br1” as “v0.1”
Rerun the analysis on branch1
Output → the analysis was successful, but new code was not calculated.
In sonar-scanner log I see an error as below:
INFO: Load New Code definition INFO: Load New Code definition (done) | time=42ms INFO: Computing New Code since fork with 'v0.1' WARN: Could not find ref: v0.1 in refs/heads, refs/remotes/upstream or refs/remotes/origin WARN: Branch 'v0.1' not found in git WARN: Failed to detect fork date. No New Code will be computed.
I tried using
git fetch origin --tags and
git fetch origin '+refs/tags/*:refs/tags/*' before triggering the scanner. But per the output it is not looking for tags.
Is there any way we can make the scanner look for tags. Appreciate your time.