CE crash when sending GitHub branch analysis

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube 9.9.0 and earlier)
  • how is SonarQube deployed: Docker
  • what are you trying to achieve
    Analyzing PR succeeds, but branch fails with stack-trace
  • what have you tried so far to achieve this
    Webhooks from Sonarqube to Github show analysis results in Pull-Request Conversation. However, on
    a branch analysis (even main/master) there is NO location in GitHub to show analysis results.
2023.07.12 09:54:31 INFO  ce[AYlJhgt6hHtue8ajDHSX][o.s.c.t.s.ComputationStepExecutor] Publishing taint vulnerabilities events | status=SUCCESS | time=3ms
2023.07.12 09:54:31 INFO  ce[AYlJhgt6hHtue8ajDHSX][o.s.c.t.s.ComputationStepExecutor] Send issue notifications | newIssuesNotifs=0 | newIssuesDeliveries=0 | myNewIssuesNotifs=0 | myNewIssuesDeliveries=0 | changesNotifs=0 | changesDeliveries=0 | status=SUCCESS | time=3ms
2023.07.12 09:54:31 INFO  ce[AYlJhgt6hHtue8ajDHSX][o.s.c.t.s.ComputationStepExecutor] Publish task results | status=SUCCESS | time=0ms
2023.07.12 09:54:31 INFO  ce[AYlJhgt6hHtue8ajDHSX][o.s.c.t.s.ComputationStepExecutor] Trigger refresh of Portfolios and Applications | refreshesAPP=0 | refreshesVW=0 | status=SUCCESS | time=17ms
2023.07.12 09:54:31 INFO  ce[AYlJhgt6hHtue8ajDHSX][o.s.c.t.p.a.p.PostProjectAnalysisTasksExecutor] Webhooks | globalWebhooks=0 | projectWebhooks=0 | status=SUCCESS | time=5ms
2023.07.12 09:54:31 INFO  ce[AYlJhgt6hHtue8ajDHSX][o.s.c.t.p.a.p.PostProjectAnalysisTasksExecutor] Pull Request decoration | status=SUCCESS | time=0ms
2023.07.12 09:54:33 WARN  ce[AYlJhgt6hHtue8ajDHSX][c.s.G.B.A.B] Failed to access GitHub, the repository or the Pull Request
java.lang.IllegalStateException: Failed to report status to Devops platform: couldn't get the branch details
	at com.sonarsource.G.D.G.M.B(Unknown Source)
	at com.sonarsource.G.D.G.M.D(Unknown Source)
	at java.base/java.util.Optional.orElseThrow(Unknown Source)
	at com.sonarsource.G.D.G.M.C(Unknown Source)
	at com.sonarsource.G.D.G.M.A(Unknown Source)
	at com.sonarsource.G.D.G.G.A(Unknown Source)
	at com.sonarsource.G.D.G.B.A(Unknown Source)
	at java.base/java.lang.Iterable.forEach(Unknown Source)
	at com.sonarsource.G.D.G.B.A(Unknown Source)
	at com.sonarsource.G.D.k.A(Unknown Source)
	at org.sonar.ce.async.SynchronousAsyncExecution.addToQueue(SynchronousAsyncExecution.java:27)
	at com.sonarsource.G.D.k.A(Unknown Source)
	at java.base/java.util.Optional.ifPresent(Unknown Source)
	at com.sonarsource.G.D.k.finished(Unknown Source)
	at org.sonar.ce.task.projectanalysis.api.posttask.PostProjectAnalysisTasksExecutor.executeTask(PostProjectAnalysisTasksExecutor.java:102)
	at org.sonar.ce.task.projectanalysis.api.posttask.PostProjectAnalysisTasksExecutor.finished(PostProjectAnalysisTasksExecutor.java:93)
	at org.sonar.ce.task.step.ComputationStepExecutor.executeListener(ComputationStepExecutor.java:89)
	at org.sonar.ce.task.step.ComputationStepExecutor.execute(ComputationStepExecutor.java:61)
	at org.sonar.ce.task.projectanalysis.taskprocessor.ReportTaskProcessor.process(ReportTaskProcessor.java:75)
	at org.sonar.ce.taskprocessor.CeWorkerImpl$ExecuteTask.executeTask(CeWorkerImpl.java:212)
	at org.sonar.ce.taskprocessor.CeWorkerImpl$ExecuteTask.run(CeWorkerImpl.java:194)
	at org.sonar.ce.taskprocessor.CeWorkerImpl.findAndProcessTask(CeWorkerImpl.java:160)
	at org.sonar.ce.taskprocessor.CeWorkerImpl$TrackRunningState.get(CeWorkerImpl.java:135)
	at org.sonar.ce.taskprocessor.CeWorkerImpl.call(CeWorkerImpl.java:87)
	at org.sonar.ce.taskprocessor.CeWorkerImpl.call(CeWorkerImpl.java:53)
	at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:131)
	at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:74)
	at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:82)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)

Successful analysis should look like this:


Hi,

Analysis results shouldn’t be reported to GitHub for branches. This only works for PRs. Do you know why SonarQube is even trying? Are you analyzing branches with PR parameters, hoping to force this reporting?

 
Ann

Not intentionally, what specific parameters should be unset to disable the GitHub report?

Hi,

Take a look at your Scanner Context (Project Settings → Background Tasks → [row cog menu] → Show Scanner Context) to see if sonar.pullreqeust shows up anywhere.

If it does, then we’ll need to work backward to see where the properties got set.

If it doesn’t, then we’ll need to start from your analysis log.

 
Ann

In this particular case, the analysis log above was from a PR (udf-envelope-schema,) and its Scanner Context is attached. I have another analysis for a master branch (aps-provisioning-v2) I am also attaching to show context.
Scanner Context- udf-envelope-schema [Project Analysis].txt (7.8 KB)
Scanner Context- aps-provisioning-v2 [Project Analysis].txt (8.2 KB)

Hi,

If you’re getting that error message in the logs for PRs too, then that indicates a misconfiguration. Go into Administration → General Settings → DevOps Platform Integrations, and the UI should get you started.

 
Ann

It looks OK to me:

Hi,

Okay, backing up to the OP here:

Does analysis actually fail (no updated results in the UI?) or is it just that you see this stacktrace?

And I guess in your PRs you do see the analysis results decorated in GitHub?

Also, remind me: is everything (including GH) self-hosted, or are you using cloud providers?

 
Ann

Analysis succeeds; stacktrace is in ce.log and warning appears in project UI.

Yes, that is so.

We are using public GitHub (private org) and self-hosted Sonarqube & Jenkins CI.

Hi,

Thanks for the confirmation. I’m not finding anything obvious to cause this, so I’m going to flag it for more expert eyes.

 
Ann

Hi @Jaff

We’ve noticed in scanner context for the master branch that you set:

sonar.scm.disabled=True

As you have GitHub integration set up, and the SCM is disabled, SonarQube tries to report the analysis results but has no information about which branch to report the status for.
Could you remove this setting and see if this fixes the issue?

This does fix the issue.
udf-envelope-schema_scanner-context.txt (7.8 KB)

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