Pull Request Decoration: Not getting code analysis in GitHub

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    SonarQube 8.1.0.31237
    SonarQube Scanner 2.11
    SonarScanner 4.3.0.2102
    Jenkins CI Tool
  • what are you trying to achieve
    When I submit a pull request in GitHub I want SonarQube to perform a code analysis and display results in GitHub.
  • what have you tried so far to achieve this
    Created a GitHub App and installed the app on my GitHub repository @ GitHub.com
    Configured the GitHub App in SonarQube global settings Pull Request Decoration
    Enable Pull Request Decoration at the project level
    Installed SonarQube Scanner plugin in Jenkins
    Configured SonarQube Server in Jenkins
    Configured SonarQube scanner in Jenkins

Hi,

With the imminent (next week) release of 8.3, we’ll automatically detect your branch/PR context and pass the correct additional parameters for you. Until then, you need to do your own detection & parameter setting.

 
HTH,
Ann

@ganncamp,

These parameters should be passed to Jenkins in my case, correct?

Yes, they should.

I’m still not getting any feedback from SonarQube within my pull request. Not sure what to do next.

Jenkins_build

sonar_jenkins

@ganncamp

I’m seeing the following in my ce.log file. I didn’t noticed this earlier.

image

Hi,

It sounds like your job probably does some sort of interim commit with the PR code plus the target to get the merge result? This is the error we see when something like that’s going on; your job does a local commit & that commit ID doesn’t exist in the remote repository to be decorated.

 
Ann

@ganncamp,

The current pull request number was not passed in as a parameter, which caused a conflict between commit numbers. I resolved this problem and kicked off a new build. I’m no longer seeing the warning "Pull request decoration did not happen. "

The GitHub pull request is still not decorated with the SonarQube analysis. When I checked the ce.log I see the following warning in my log…

2020.04.22 08:55:51 WARN ce[AXGiLGBsksVipM4vXyNd][c.s.C.B.B.B] Failed to access GitHub, the repository or the Pull Request

2020.04.22 14:04:58 WARN ce[c.s.C.B.B.B] Failed to access GitHub, the repository or the Pull Request
org.kohsuke.github.GHFileNotFoundException: {“message”:“Not Found”,“documentation_url”:“https://developer.github.com/v3/pulls/#get-a-single-pull-request”}
at org.kohsuke.github.Requester.handleApiError(Requester.java:691)
at org.kohsuke.github.Requester._to(Requester.java:298)
at org.kohsuke.github.Requester.to(Requester.java:239)
at org.kohsuke.github.GHRepository.getPullRequest(GHRepository.java:696)
at com.sonarsource.C.B.B.B.A(Unknown Source)
at com.sonarsource.C.D.E.A.C(Unknown Source)
at com.sonarsource.C.D.E.A.A(Unknown Source)
at com.sonarsource.C.D.E.I.A(Unknown Source)
at com.sonarsource.C.D.a.A(Unknown Source)
at java.base/java.util.Optional.ifPresent(Optional.java:183)
at com.sonarsource.C.D.a.B(Unknown Source)
at com.sonarsource.C.D.a.A(Unknown Source)
at org.sonar.ce.async.SynchronousAsyncExecution.addToQueue(SynchronousAsyncExecution.java:27)
at com.sonarsource.C.D.a.A(Unknown Source)
at java.base/java.util.Optional.ifPresent(Optional.java:183)
at com.sonarsource.C.D.a.finished(Unknown Source)
at org.sonar.ce.task.projectanalysis.api.posttask.PostProjectAnalysisTasksExecutor.executeTask(PostProjectAnalysisTasksExecutor.java:118)
at org.sonar.ce.task.projectanalysis.api.posttask.PostProjectAnalysisTasksExecutor.finished(PostProjectAnalysisTasksExecutor.java:109)
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:209)
at org.sonar.ce.taskprocessor.CeWorkerImpl$ExecuteTask.run(CeWorkerImpl.java:191)
at org.sonar.ce.taskprocessor.CeWorkerImpl.findAndProcessTask(CeWorkerImpl.java:158)
at org.sonar.ce.taskprocessor.CeWorkerImpl$TrackRunningState.get(CeWorkerImpl.java:133)
at org.sonar.ce.taskprocessor.CeWorkerImpl.call(CeWorkerImpl.java:85)
at org.sonar.ce.taskprocessor.CeWorkerImpl.call(CeWorkerImpl.java:53)
at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:125)
at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:69)
at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:78)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.io.FileNotFoundException: https://api.github.com/repos/company/project/pulls/54
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at java.base/sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1969)
at java.base/sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1964)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1963)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1531)
at java.base/sun.net.www.protocol.http.HttpURLConnection$9.run(HttpURLConnection.java:1507)
at java.base/sun.net.www.protocol.http.HttpURLConnection$9.run(HttpURLConnection.java:1505)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.AccessController.doPrivilegedWithCombiner(AccessController.java:795)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1504)
at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:250)
at org.kohsuke.github.Requester.parse(Requester.java:617)
at org.kohsuke.github.Requester.parse(Requester.java:599)
at org.kohsuke.github.Requester._to(Requester.java:277)
… 34 common frames omitted
Caused by: java.io.FileNotFoundException: https://api.github.com/repos/company/project/pulls/54
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1915)
at java.base/sun.net.www.protocol.http.HttpURLConnection$9.run(HttpURLConnection.java:1507)
at java.base/sun.net.www.protocol.http.HttpURLConnection$9.run(HttpURLConnection.java:1505)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.AccessController.doPrivilegedWithCombiner(AccessController.java:795)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1504)
at java.base/java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:527)
at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:334)
at org.kohsuke.github.Requester.parse(Requester.java:607)
… 36 common frames omitted
2020.04.22 14:04:58 INFO ce[o.s.c.t.p.a.p.PostProjectAnalysisTasksExecutor] Pull Request decoration | status=SUCCESS | time=520ms

Hi,

This seems like a new problem. We try to keep it to one topic per thread. That keeps things tidy, helps users who are looking for answers, and cuts down on confusion. Could you start a new thread with your new question, please?

 
Thx,
Ann