SonarQube (Developer Edition) and GitHub pull-request decoration

Hi, I can’t manage to make the pull-request decoration work! We’re using Github.com

The analysis works and I can see the results in SonarQube, but this message is show: “Pull request decoration did not happen. Please install Github application on the repository’s organization or user.”

Followed all the tutorials and tried all the steps more than once! Also the GitHub authentication and sign-up works like a charm.

Versions:

  • SonarQube: 8.3.1.34397
  • License: Developer Edition
  • SonarScanner: 4.3.0.2102-linux

There’s nothing in the logs (even with TRACE level), the only mention to pull-requests and some error indication is:

2020.06.11 15:27:03 DEBUG ce[AXKj_dRT3vwedgzpgy8V][c.s.C.B.B.A.A.D] GET response did not have expected HTTP code (was 404): Not Found
2020.06.11 15:27:03 DEBUG ce[AXKj_dRT3vwedgzpgy8V][c.s.C.B.B.A.A.D] GET response did not have expected HTTP code (was 404): Not Found
2020.06.11 15:27:03 INFO  ce[AXKj_dRT3vwedgzpgy8V][o.s.c.t.p.a.p.PostProjectAnalysisTasksExecutor] Pull Request decoration | status=SUCCESS | time=159ms

This is the sonar-scanner command (run in CircleCI):

tmp/sonar-scanner-4.3.0.2102-linux/bin/sonar-scanner \
                -Dsonar.login=$SONARQUBE_KEY \
                -Dsonar.pullrequest.branch=$CIRCLE_BRANCH \
                -Dsonar.pullrequest.key=${CIRCLE_PULL_REQUEST##*/}

And my

We are experiencing a similar problem using the same SonarQube version, however using Jenkins for CI. I discovered that I could achieve the desired result if I set the sonar.pullrequest.key=PR-${CHANGE_ID} because the jenkins slave agent had the checked-out directory named “_PR-NNN” (where NNN = PR number) Now the errors do not show up in the results page; however, the web.log contains lines such as:

2020.06.07 18:39:05 WARN  web[AXJ8KiXhCJqzmajNAbJ2][c.s.C.D.E.F] GitHub pullrequest number is expected to be an int. Was: PR-326
2020.06.07 18:41:53 WARN  web[AXJ8KiXhCJqzmajNAbKz][c.s.C.D.E.F] GitHub pullrequest number is expected to be an int. Was: PR-326
2020.06.07 18:48:31 WARN  web[AXJ8KiXhCJqzmajNAbM5][c.s.C.D.E.F] GitHub pullrequest number is expected to be an int. Was: PR-326

Hi @Jaff thanks for the comment!

I’ve tried several different values to the sonar.pullrequest.key and the only one that don’t show this errors are the pr number, but none of the combinations worked.

Found the issue! :tada:

When configuring my GitHub integration in General Settings -> ALM Integrations I’ve set the field “GitHub URL” to my GitHub app url, and it was causing the issue.

Setting the “GitHub URL” to https://api.github.com fixed it!

1 Like

Thanks for sharing the solution @Felipe-M-Malinoski ! :slight_smile:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.