Looking for help with github comments

vsts
branches

(Michael) #1

Sonarqube Developer Edition Version 7.2.1.
Running Integrated with MSBuild in Azure Devops (VSTS)

so we upgraded to the developer edition to use the multi-branch analysis which works great! however one thing that we lost was the github comments which decorated the PR’s. is it possible to use both at the same time? we tried it and recieved the following issue.

ERROR: Error during SonarQube Scanner execution
ERROR: A pull request analysis cannot have the branch analysis parameter ‘sonar.branch.name’

we got around the issue in the community edition by doing the following

if (PR)
prepare analysis with following params (sonar.pullrequest.base, sonar.pullrequest.branch, sonar.pullrequest.key)
msbuild
run code analysis

if (master)
prepare analysis (no params)
msbuild
run code analysis
publish quality gates

which apparently does not work anymore.

does anybody have any suggestions for doing both multi-branch for PR’s, and leaving the github comments as well?


(G Ann Campbell) #2

Hi,

It looks like you’ve only done half the configuration. Go to Administration > Pull Requests and specify your provider and your personal access token.

 
Ann


(Michael) #3

we have verified that is correct. still same issue.


(G Ann Campbell) #4

Hi,

I’m confused. Your screenshot shows GitHub configuration, but your initial post mentions “Azure Devops (VSTS)”. You for sure will not be able to annotate VSTS PRs with GH credentials. :slight_smile:

 
Ann


(Michael) #5

sorry i was not clear, we use Azure dev ops for CI/CD, and github for source.


(G Ann Campbell) #6

Then this may be a permissions issue. Make sure the token you generated has push permissions.

 
Ann


(Michael) #7

Repo:All is correct yes? image


(G Ann Campbell) #8

Hi,

That looks fine. Have you also set up the repository and endpoint? (https://docs.sonarqube.org/latest/analysis/pull-request/)

 
Ann


(Michael) #9

ahh i missed the part about sonar.pullrequest.github.repository ans sonar.pullrequest.github.endpoint thanks @ganncamp !


(Austin Gardner) #10

I am taking over trying to get this to work from Michael. We followed the document you mentioned but we are still not seeing the nice inline comments on the github PR. Below are the advanced properties on the Prepare Analysis task in our Azure Devops (VSTS) Pipeline.

Any additional help would be appreciated.


(G Ann Campbell) #11

Hi,

Those need to be defined at the global level in the UI. Decoration happens after scanner-side analysis, by which time values set on the analysis side aren’t available, as I understand it.

 
Ann


(Austin Gardner) #12

Hi,
I found the problem. From your suggestion i went into the Administration > General > Pull Request settings on the SonarQube Project itself. That fixed out problem and we are getting inline comments on the github PR now from the analysis.
Thank you for the help @ganncamp