No GitHub Pull Requests in SonarCloud using TeamCity nor PR Decoration in GitHub

github
sonarcloud
pull-request
msbuild

(Duncan) #1

I’m really struggling to get this working and I can’t figure out what I’m doing wrong.
No error messages, no PR Decoration, no PRs showing up in SonarCloud.:cry:

I’m following these directions:
https://sonarcloud.io/documentation/integrations/github/
SonarCloud application is installed on Github.
The builds are getting analyzed and results show up in SonarCloud.

When I go to Administration>Branches and Pull Requests I only see our iteration branch. No pull requests.
Sonar parameter setup:
|sonar.pullrequest.base |iter-bugatti|
|sonar.pullrequest.branch |pull/1010|
|sonar.pullrequest.github.endpoint |https://api.github.com/|
|sonar.pullrequest.github.repository |Our-Org/Our.Repo
|sonar.pullrequest.key |1010 |
|sonar.pullrequest.provider |github|

Getting the pullrequest.key into TeamCity was a PITA and I still can’t figure out how to get the pullrequest.base correct without manually setting it. Our process uses master branch as the latest release branch, we dev on an iter-* branch, and the pull requests come in on “pull/1234”.

For the pullrequest.key for anyone else using TeamCity we added another build step that uses PowerShell to set the parameter

I haven’t had any better luck running the build manually.


(Duncan) #2

We’ve done 8 pull requests and none have shown up here. It always analyzes the base branch and PR’s never show up in Adminstration > Branches and Pull Requests The docs don’t show what I should be seeing there but I don’t think that’s how it’s supposed to work.
The automated PR checks are the main thing we’re looking for, and we’re a ways into the trial and so far we’ve yet to get a single PR decorated.

Also our lines of code take us 30K over the 500K limit which is also annoying. Not sure what the right answer there is.
The rest of the analysis is pretty sweet, so maybe we’ll come back when the GitHub app is out of alpha.

Setup was painful, so directions for how to set up TeamCity other than “figure out how to get these parameters into TC” would be great.
The TeamCity plugin wasn’t useful for SonarCloud.


(Fabrice Bellingard) #3

Hi Duncan, this has nothing to do with the GitHub app itself. It is more related to the configuration of the analysis on CI side. And we don’t have any dedicated SonarCloud integration in TeamCity - so I can understand that this can be quite complex.


(Duncan) #4

Setup didn’t seem that complex, I just couldn’t figure out why pull requests weren’t getting analyzed and why they didn’t come into sonarcloud/GitHub. I couldn’t figure out if it was the app, if I’d forgotten a parameter, was sending the wrong parameter, etc.
There was no error, I just couldn’t see PR’s in SonarCloud nor in GitHub.
The docs noted that if we were using Maven it would “just work”. I’d love to have that experience in TeamCity :slight_smile: Helping TeamCity get their SonarQube plugin working with SonarCloud would be great: https://github.com/JetBrains/TeamCity.SonarQubePlugin