I am trying to decorate pull requests with SonarQube 7.7 Developer Edition but I am unable to do so.
The current system works like this
Pull Request -> Jenkins(hosted on GCP) -> SonarQube(Hosted on GCP) -> Github
Sonar is successfully scanning and generating a report via Jenkins but it is not decorating the github pull request.
PR Decoration has changed quite a bit since January 2017, when that article was published. I would reccomend checking out the current docs on GitHub Enterprise Integration (for some reasons, primarily Beta APIs, we can’t explicitly say we support Github.com / SonarQube, but it should work, see Pull Request Analysis: Decorate PRs in GitHub for @ganncamp’s in depth footnotes ).
Thanks for the update.
Currently our organisation does not have github enterprise and are trying to get pull requests to work with github.com.
We were planning to move to Sonar+Jenkins from CircleCI which we currently use and PR decoration is an important feature that was essential to our developers.
There is a PoC the coming Tuesday regarding whether we would like to move onto Sonar officially.
Not having pull request decoration is going to be a major shortcoming and will result in the transfer to Sonar being either rejected or postponed.
Is there a way to get PR decoration for github.com?
Double check my last post (which I edited, perhaps you did not see the changes). It should work with Github.com, but we can’t declare official support.
If you notice the Urls that are being displayed there, they are all my internal ip address
10.x.x.x so the links are broken,
Why isn’t it pointing to the sonar url(external ip address where sonar check ran)?
Which should be fixed when our 7.x LTS drops next month (fingers crossed) I think it’s a side effect of the GitHub.com / SonarQube on-prem combo, but to be honest I’m not 100% sure
Well I certainly hope too.
If I am not wrong PR decoration is part of the Community Edition but branch analysis is part of the Developer Edition right? or its just the latter that supports it
I am getting this warning
Could not find ref ‘{ghprbTargetBranch}’ in refs/heads or refs/remotes/origin. You may see unexpected issues and changes. Please make sure to fetch this ref before pull request analysis.
Could not find ref ‘master’ in refs/heads or refs/remotes/origin. You may see unexpected issues and changes. Please make sure to fetch this ref before pull request analysis.
This happens only when there’s a pull request to master
Any idea how to overcome it?
It’s getting rather hard to follow this thread when you edit your posts to remove the issues you faced – the solutions you find for yourself may help other users and it would be a good practice to post them (part of the unwritten contract of being in a community like this )
It looks like {ghprbTargetBranch} is not being resolved correctly in Jenkins. I’m assuming you’re using this GitHub plugin, I’d double check that you have the variable defined correctly (it looks like it needs to be prefixed with $).
I’m sorry my bad. Most of them were becuase I didn’t save the settings or the server was down, the shared compute engine we use for testing PoCs was being overloaded.(Yes it’s an unwritten social contract )
Yes correct I am using that github plugin.
Yup it’s working thanks!
It so happens that pull requests are being built appropriately and I am able to run a code analysis.
Unfortunately on a merge event sonar is not scanning the master branch and providing an analysis report. So sonar is still showing the build report for the first time master was scanned.
@Colin@simon.brandhof I am having another issue.
When I run sonar analysis on master branch (whenever there is a merge to master), sonar shows 0 problems.
According to you screenshot the properties sonar.pullrequest.* are always declared, even when analysing master. That should not be the case. They should be unset when analysing a branch that is not associated with a pull request.