Analysis path vs build path in docker based builds

Hi!
I want to have a sonarQube build pipeline in azure pipelines. The actual build step is done within a docker container where the checked out git repos are mounted into the container.The build wrapper output is mounted on the host.
My problem is that the build wrapper output is based on different paths (paths inside the container) and the analysis is done on the build agent (host) which uses a different path to the sources and build wrapper output.
Is it possible to configure SonarQubePrepare@5 to handle the different build, sources and analysis paths?

Hey there.

As requested in the template post – what version of SonarQube are you using?

Hi!

sonarqube:

  • Enterprise Edition Version 9.9.2 (build 77730)

build wrapper:

  • 6.41.1

sonar-scanner:

  • cli-5.0.1.3006

Thanks!

The limitation you describe is documented here, and is still the case today:

Important notes

  • The Build Wrapper collects information about the build, including absolute file paths (source files, standard headers, libraries, etc…). Later on, SonarScanner CLI uses this information and needs to access those paths. While this is straightforward when running these two steps on the same host, it is worth considering when using any containerization. A consequence of this is that C/C++/Objective-C analysis is NOT supported by SonarScanner CLI Docker image.

Why do you decide to run your analysis on the build agent and not in the docker container?

For now I do it in the container, but for the future I want to use the following azure pipeline tasks, and I’m not sure if this can be combined then:

# Run Code Analysis task

  • task: SonarQubeAnalyze@5

# Publish Quality Gate Result task

  • task: SonarQubePublish@5
    inputs:
    pollingTimeoutSec: ‘300’