Download latest sonar scanner from selfhosted Sonarserver

I would like to download the latest sonar-scanner directly from the self hosted sonar server.
We run a CI and scan C/C++ code, and would like our pipelines to use a scanner which matches the Sonarqube server. As we are building C++ we can not use the offical sonar docker images.
Since the Server is updated centrally, the easiest way for us to obtain an automated of the scanner would be to download it from said server.
This is already implemented for the Buildwrapper (mysonarserver.net/static/cpp/build-wrapper-linux-x86.zip). It would be great if it would be just as easy to download the scanner.
I.e. the following should work:

curl -O mysonarserver.net/static/sonar-scanner-linux-x86.zip

This way, our CI pipelines can simply download the scanner on demand and be sure it matches the Sonarserver.

It would be even better if we could detect the Version by querying the server (i.e. curl -O mysonarserver.net/static/sonar-scanner-version should respond with “sonar-scanner 7.0.1”), so that we know if there is a new version, this way we could automatically build docker images in a nightly build when the version is updated.

This request is a refresh of How to download sonar scanner from the sonarqube server that is hosted

Hi @MalteV,

Thank you for being an active user in the community.

I understand that you want to automate the download of a scanner-cli that matches your self hosted sonar server.

The scanner-cli version does not need to match the SonarQube server version. When you run any version of scanner-cli version, the scanner downloads the latest scanner engine available so you don’t have to worry about it.

Our recommendation is to:

  1. Always use an active/supported version of your SonarQube.
  2. Prioritize the latest scanner-cli version version for bug fixes on the wrapper, but not primarily for compatibility. You could for example update your scan version once a year, when they move to a new LTA. Really depends on their capacity/willingness to stay up to date.

You can download the latest scanner-cli version from the documentation page.

I hope this answers your question.