Flows
Flows

Reputation: 3863

SonarQube fails to get git blame information from Jenkins project

I configured a Jenkins Main Project P to manage two git repository A and B. This main project P only updates git sources and calls sonar analysis on sources from his workspace.

Here's my tree folder.

{Jenkins Install Path} \ workspace \ P 
                                     |-- A 
                                         |-- .git/
                                         |-- all projects A files
                                     |-- B
                                         |-- .git/
                                         |-- all projects B files

When Jenkins runs sonar analysis for P, I got the following error

SCM provider for this project is: git
2664 files to be analyzed
0/2664 files analyzed
Missing blame information for the following files:
(all files)

The error is logical because SonarQube is looking for a .git folder under {Jenkins Install Path} \ workspace \ P. It doesn't exist.

I looked around the internet to find a solution but I didn't find an answer. I am using SonarQube 5.5 installed on windows.

Do you have some idea to make SonarQube working with my configuration ?

This case is different than Sonarqube: Missing blame information for the following files because the root cause is I am using two git folder fetch by a single SonarQube analysis.

Sources I visited and read several times

SonarQube Git Plugin

Seems similar but different issue

Global SCM error in SonarQube

Upvotes: 2

Views: 11435

Answers (2)

Flows
Flows

Reputation: 3863

Based on @CSchulz's answer I found the solution using SonarQube module

I configured SonarQube to use two submodule corresponding to my A and B git projects. Each project get the name of git module as the important projectBaseDir parametre.

sonar.projectKey=P
sonar.projectName=P
sonar.projectVersion=4.0.0
sonar.binaries=.

sonar.cxx.includeDirectories=Common/Path
sonar.cxx.cppcheck.reportPath=cppCheckReport.xml # Reports are present in A and B forlder

#  2 modules definition
sonar.modules=A,B

# Module A
IHM.sonar.projectBaseDir=A
IHM.sonar.projectName=A
IHM.sonar.sources=.
IHM.sonar.cxx.includeDirectories=XXX

# Module B
Shares.sonar.projectBaseDir=B
Shares.sonar.projectName=B
Shares.sonar.sources=.
Shares.sonar.cxx.includeDirectories=XXX

I needed to figure out some configurations but it works and it is fine for me.

Upvotes: 1

CSchulz
CSchulz

Reputation: 11020

You can setup an analysis job which is triggered by P.

The analysis job can take a parameter which repository inside of the workspace of P should be analysed. The job itself should use the same workspace as P and only call the SonarQube analysis.

Upvotes: 3

Related Questions