It should not be a warning when failing to publish github results when master

  • which versions are you using (SonarQube 9.4.0-DE, dockerized)
  • what are you trying to achieve
    Analysis of master branch
  • what have you tried so far to achieve this
    Normal processing of code base in Jenkins, Overview page shows a warning. Log file contains stack-trace for failure:
2022.07.12 08:39:43 INFO  ce[AYHxkGIhMeSggZqRht3T][o.s.c.t.p.a.p.PostProjectAnalysisTasksExecutor] Webhooks | globalWebhooks=0 | projectWebhooks=0 | status=SUCCESS | time=2ms
2022.07.12 08:39:43 INFO  ce[AYHxkGIhMeSggZqRht3T][o.s.c.t.p.a.p.PostProjectAnalysisTasksExecutor] Pull Request decoration | status=SUCCESS | time=0ms
2022.07.12 08:39:44 WARN  ce[AYHxkGIhMeSggZqRht3T][c.s.F.C.A.B] Failed to access GitHub, the repository or the Pull Request
2022.07.12 08:39:44 WARN  ce[AYHxkGIhMeSggZqRht3T][c.s.F.D.F.J] Branch decoration failed
java.lang.IllegalStateException: Failed to report status to Devops platform: couldn't get the branch details
	at com.sonarsource.F.D.F.J.B(Unknown Source)
	at com.sonarsource.F.D.F.J.D(Unknown Source)
	at java.base/java.util.Optional.orElseThrow(Optional.java:408)
	at com.sonarsource.F.D.F.J.C(Unknown Source)
	at com.sonarsource.F.D.F.J.A(Unknown Source)
	at com.sonarsource.F.D.F.L.A(Unknown Source)
	at com.sonarsource.F.D.k.A(Unknown Source)
	at org.sonar.ce.async.SynchronousAsyncExecution.addToQueue(SynchronousAsyncExecution.java:27)
	at com.sonarsource.F.D.k.A(Unknown Source)
	at java.base/java.util.Optional.ifPresent(Optional.java:183)
	at com.sonarsource.F.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:90)
	at org.sonar.ce.task.step.ComputationStepExecutor.execute(ComputationStepExecutor.java:62)
	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(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:829)
2022.07.12 08:39:44 INFO  ce[AYHxkGIhMeSggZqRht3T][o.s.c.t.p.a.p.PostProjectAnalysisTasksExecutor] Report branch Quality Gate status to devops platforms | status=SUCCESS | time=1014ms
2022.07.12 08:39:44 INFO  ce[AYHxkGIhMeSggZqRht3T][o.s.c.t.CeWorkerImpl] Executed task | project=com.XXX.vod.catalog:pubmind-core | type=REPORT | branch=master | branchType=BRANCH | id=AYHxkGIhMeSggZqRht3T | submitter=sonar | status=SUCCESS | time=4426ms

Hi,

Could you go to the project’s Background Tasks page (under Project Settings) and use the cog menu on the relevant task to look at the scanner context? I’m interested in the ‘Project scanner properties’ section to know whether branch/PR parameters were passed to the analysis.

 
Ann

Sorry, I meant to get back to you on this issue. Here’s the detail you asked about.
pubmind-core_context.txt (8.4 KB)

Hi,

I’m not seeing any PR-related properties here. Is this an ongoing problem?

 
Ann

Yes, usually dependent on job setup in Jenkinsfile. At one time, we suggested developers specify branch properties, but then were told it was not necessary, so I reversed those instructions. I learned later that strategy was often incorrect. I can try re-running this job with Jenkins Replay option to observe results. However, as I pointed out since this is master, it should NOT be handled as a Pull-Request.

Hi,

I’m confused. What publishing are you expecting for the main branch? We only publish to the DevOps Platform for Pull/Merge Requests.

 
Ann

We do not expect publish of results, but we also do not expect warnings about something being missed that should not be there.

Hi,

Okay, I think I understand now. Sorry I’ve been slow on the uptake. What version are you running?

 
Ann

9.4.0 now, planning 9.6.0 upgrade now. My manager has been reluctant to upgrade on x.x.0 releases, expecting point releases to follow as was true a while back.

1 Like

Hi @Jaff,

It isn’t being treated as a PR; it’s trying to publish the quality gate status on your master branch. I understand the “Pull Request decoration” line is confusing, but the important line is just underneath: “Branch decoration failed”.

It looks like the API call to {GITHUB_API_URL}/repos/{REPO}/branches/master isn’t returning any info.

  • Can SonarQube correctly contact your GitHub server (you can check this via Administration > General Settings > DevOps Platform Integrations)?
  • If it can, could it be your branch name is somehow different on Jenkins than on GitHub (like after a renaming from “master” to “main”, or vice-versa)?
  • Are you using github.com, or GitHub Enterprise? If the latter, which version are you using?

Patch releases are more the exception rather than the rule (except if you’re on an LTS version). At least, we try very hard to keep it like that :smile:. Of course, 9.6.1 is proving me wrong here :wink:. But there are many versions that never had a patch version (like 9.1.0, 9.3.0, 9.4.0, and 9.5.0).

Per your questions, we are NOT using GitHub Enterprise as yet, still github.com. And pretty sure in this instance that branch rename did not occur.

Hi again,

And did you manage to check whether SonarQube can correctly contact GitHub? You can check this via Administration > General Settings > DevOps Platform Integrations. Click on the GitHub tab, and click on Check configuration.

Yes, we have no issues connecting to GitHub, save for occasional network glitches.

Can you try calling https://api.github.com/repos/{REPO}/branches/master manually? What does GitHub return?

{
  "message": "Not Found",
  "documentation_url": "https://docs.github.com/rest/reference/repos#get-a-branch"
}

So apparently there’s an issue with your master branch on GitHub. I’d investigate in that direction. SonarQube is reporting that it cannot publish a Quality Gate status to your master branch, because GitHub returns an error. It doesn’t seem related to SonarQube itself.