Github pull request - start a pending check run during analysis

  • using SonarQube Enterprise Edition v10.7
    • DevOps platform integration to GitHub for Quality Gate status reporting
    • Jenkins
      • SonarQube Scanner for Jenkins 2.17.2
      • Running sonar scanner within Docker for dotnet and typescript builds

We have been running the sonar scanner with

  • sonar.qualitygate.wait=true
  • sonar.qualitygate.timeout=900

This works well, most of the time,

  • Jenkins run starts
  • GitHub pull request indicates that there is a pending check running
  • Jenkins build invokes the scanner, and blocks on the SonarQube analysis of the quality gate
  • SonarQube adds its pass / fail result as a completed check on the PR
  • Jenkins updates the PR with it’s check result

The problem that I’m trying to solve is a intermittent Jenkins timeouts, waiting for the SonarQube analysis to complete, for larger repos, PRs, and times of higher loads.

I tried removing the sonar.qualitygate.wait, reasoning: Since Sonar is adding a check to the PR, the merge will be blocked until that is done, so why make Jenkins wait around for the result?

However, I found that the Jenkins check run would be shown as complete on the PR, with no indication that there was a Sonar check running, until Sonar added its final result.

So we’ve avoided the Jenkins timeouts, but there’s now a time window where a developer could merge a PR that is about to fail a Sonar quality gate.

So, my question: Is there a way to have the Sonar analysis start a GitHub check run with an in_progress status when it begins its analysis?

Hey there.

I think that all you have to do is set the SonarQube check as required/mandatory on the GitHub side. At that point, the PR doesn’t care whether or not the analysis has started – it will wait for the check.

(docs)


Your version is also past EOL. You should upgrade to either the latest version or the current LTA (long-term active version) at your earliest convenience. Your upgrade path is:

10.7 → 2025.1

You may find these resources helpful:

If you have questions about upgrading, feel free to open a new thread for that here.

Thanks, that worked for me.

(Yes, our version upgrade is in the works.)

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