How do I add a single repo with two builds?

  • SonarQube v9.6.1

I have a single repo that contains two C++ builds. I’ve setup a CI build using Github Actions and now I’m adding SonarQube integration. The process is:

  1. Download and install the SonarQube build wrapper
  2. Make the first build (using build-wrapper-linux-x86-64).
  3. Make the second build (build-wrapper-linux-x86-64).
  4. Download and install the SonarScanner.
  5. Run SonarQube analysis.

That seems to work fine but when I look at the Code in SonarQube the first build has zero Bugs, Vulnerabilities, Code Smells or Security Hotspots. Is the result of the first build being overwritten by the second? They’re using the same bw-output directory.

I tried writing into separate bw-output directory and calling SonarQube analysis twice but still nothing.

Hello @Tom_Isaacson2

Welcome to our community.

If it’s possible in your case, a quick fix could be:

  • write a small script that makes the two builds
  • call the script under build-wrapper-linux-x86-64
  • then download and run the scanner

By the way, you are running a quite old and unsupported version of SonarQube. I encourage you to update to 9.9 LTS or 10.4

That’s what I tried originally. I ended up creating two SonarQube projects and treating them as separate within the same repo, which works.

I don’t have any ability to upgrade our server, that’s IT.

@Tom_Isaacson2

  1. You said the script approach is what you tried initially. What did not work?
  2. It seems you went for another approach with 2 projects. So, your problem is fixed?