Hi Sonar Team!
SonarQube 7.7 on-prem
Sonar Scanning with Gradle plugin
GoCD as the CI
BitBucket for pull-requests
Running a pull-request analysis inside a pull-request pipelines:
- does create a PR branch on Sonar, you can find it on the UI
- it contains no code at all, and thus no issues
- in BitBucket the SonarQube integration does pop-up, showing 0 issues and passed state
I have some new code in my pull-request that contains some issue. ( I put them there ) I expect all new code to be visible on the Sonar UI, and for the new issues to be visible in Sonar UI, and annotated into the BitBucket pullrequest.
BitBucket-Sonar connection works
I configured the required properties. The summary is successfully created in BitBucket, even though it has 0 issues. The summary is also created/updated if I trigger the sonar preview build locally ( assuming I set the same properties that would be active in GoCD).
The properties required for preview annotations should be fine
If I set the same properties locally, and trigger the sonar analysis, everything seems to work fine. In Sonar the pr branch is updated, there is the code, and my fake issues are found. In BitBucket the issues are annotated correctly.
So it seems like in GoCD the stuff that is analysed is somehow different. I checked roughly, my files and fake issues are of course there. Maybe there might be some deeper issue with how the git checkout is really made.
If I check
git branch in my local checkout, I get two results
- the name of the feature branch I am working on. This is what I want to merge into master.
However checking the same command in GoCD only results in
master. I’m not yet sure how much the Sonar scanner relies on the Git information. This could be an issue.
- Does Sonar rely on git information directly, besides the
sonar.pullrequest.branchhave to be precisely the git branch name for things to work, or is it rather a nice to have thing for easy comparison?
This issue around CircleCI is probably related, I did not yet try the suggestion there: No code or issue found in pull request decorations (github + circleci)
Thanks and cheers,