Git Pull request decoration problem

  • which versions are you using - 7.6 community upgrade to 7.8 developer
  • what are you trying to achieve - github checks should work
  • what have you tried so far to achieve this - description below

i am using version 7.6 community, try to upgrade to 7.8 developer and start using Pull request decoration. Unfortunately i have one error.

currently using sonarscanner

First:

dotnet sonarscanner begin /k:“MyProj”
/d:sonar.host.url=“https://sonar***”
/d:sonar.login=“MyToken” /v:“1.0.1”
/d:sonar.pullrequest.branch=testBranch /d:sonar.pullrequest.key=45 /d:sonar.pullrequest.base=master /d:sonar.pullrequest.provider=github
/d:sonar.pullrequest.github.repository=MyCompany/MyRepo /d:sonar.pullrequest.github.endpoint=https://api.github.com/

Next:

dotnet build C:\root**\GP.MyProj.sln

On the End

dotnet sonarscanner end /d:sonar.login=“MyToken”

Everything without pull request decoration work great.

On UI i can see one warning

Pull request decoration did not happen. No revision information available

In section “Pull Requests” i have chosen provider (GitHub)
and I fill “Integration with GitHub” section

ce.log


 2019.07.04 14:03:18 WARN  ce[AWu9S8b6cpaaYPeod9-P][c.s.C.C.D.J] Unexpected exception while clearing reviews
 org.kohsuke.github.GHException: Failed to retrieve h.ttps://api.github.com/repos/MyCompany/MyRepo/statuses/1fsd******55hf******************fdg67gv
 	at org.kohsuke.github.Requester$PagingIterator.fetch(Requester.java:521)
 	at org.kohsuke.github.Requester$PagingIterator.hasNext(Requester.java:486)
 	at org.kohsuke.github.PagedIterator.fetch(PagedIterator.java:44)
 	at org.kohsuke.github.PagedIterator.hasNext(PagedIterator.java:32)
 	at com.sonarsource.C.C.D.K.G(Unknown Source)
 	at com.sonarsource.C.C.D.J.A(Unknown Source)
 	at com.sonarsource.C.C.D.J.A(Unknown Source)
 	at java.util.Optional.ifPresent(Unknown Source)
 	at com.sonarsource.C.C.D.J.A(Unknown Source)
 	at com.sonarsource.C.C.Z.A(Unknown Source)
 	at java.util.Optional.ifPresent(Unknown Source)
 	at com.sonarsource.C.C.Z.B(Unknown Source)
 	at com.sonarsource.C.C.Z.A(Unknown Source)
 	at org.sonar.ce.async.SynchronousAsyncExecution.addToQueue(SynchronousAsyncExecution.java:27)
 	at com.sonarsource.C.C.Z.A(Unknown Source)
 	at java.util.Optional.ifPresent(Unknown Source)
 	at com.sonarsource.C.C.Z.finished(Unknown Source)
 	at org.sonar.ce.task.projectanalysis.api.posttask.PostProjectAnalysisTasksExecutor.executeTask(PostProjectAnalysisTasksExecutor.java:113)
 	at org.sonar.ce.task.projectanalysis.api.posttask.PostProjectAnalysisTasksExecutor.finished(PostProjectAnalysisTasksExecutor.java:107)
 	at org.sonar.ce.task.step.ComputationStepExecutor.executeListener(ComputationStepExecutor.java:91)
 	at org.sonar.ce.task.step.ComputationStepExecutor.execute(ComputationStepExecutor.java:63)
 	at org.sonar.ce.task.projectanalysis.taskprocessor.ReportTaskProcessor.process(ReportTaskProcessor.java:81)
 	at org.sonar.ce.taskprocessor.CeWorkerImpl$ExecuteTask.executeTask(CeWorkerImpl.java:207)
 	at org.sonar.ce.taskprocessor.CeWorkerImpl$ExecuteTask.run(CeWorkerImpl.java:189)
 	at org.sonar.ce.taskprocessor.CeWorkerImpl.findAndProcessTask(CeWorkerImpl.java:156)
 	at org.sonar.ce.taskprocessor.CeWorkerImpl$TrackRunningState.get(CeWorkerImpl.java:131)
 	at org.sonar.ce.taskprocessor.CeWorkerImpl.call(CeWorkerImpl.java:83)
 	at org.sonar.ce.taskprocessor.CeWorkerImpl.call(CeWorkerImpl.java:51)
 	at java.util.concurrent.FutureTask.run(Unknown Source)
 	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
 	at java.util.concurrent.FutureTask.run(Unknown Source)
 	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown Source)
 	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
 	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
 	at java.lang.Thread.run(Unknown Source)
 2019.07.04 14:03:18 TRACE ce[AWu9S8b6cpaaYPeod9-P][sql] time=4ms | sql=insert into ce_task_message ( uuid, task_uuid, message, created_at ) values ( ?, ?, ?, ? ) | params=AWu9S--JTeVm-N7DMYGh, AWu9S8b6cpaaYPeod9-P, **Pull request decoration did not happen. No revision information available**, 1562248998794

When i am using new, clean instance of SQ 7.8 developer Pull request decoration work perfect .
What can I check more ?

This can happen when the appropriate SCM plugin could not be detected. There should be more details about this in the scanner logs.

The other issue, with “Unexpected exception while clearing reviews”, we already know about, you can track it on SONAR-12243. The ticket includes the workaround to make PR decoration work:

Two additional permissions are currently required on the GitHub App in order to decorate pull requests on private repositories:

  • Pull Request - Read Only
  • Commit Status - Read Only

Hello,

Thanks for help, now its working correctly.
Am I understand it good, SCM must be enabled to make PR decoration work ?

Regards
Paweł

Yes, SCM is used to find the files that changed and the lines that changed relative to the base branch. Without that, the PR analysis will not be very useful.