SonarQube 无法从 Jenkins 项目中获取 git blame 信息 [英] SonarQube fails to get git blame information from Jenkins project
问题描述
我配置了一个 Jenkins 主项目 P
来管理两个 git 仓库 A
和 B
.这个主项目 P
只更新 git 源并从他的工作区调用声纳分析.
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.
这是我的树文件夹.
{Jenkins Install Path} workspace P
|-- A
|-- .git/
|-- all projects A files
|-- B
|-- .git/
|-- all projects B files
当 Jenkins 对 P
运行声纳分析时,出现以下错误
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)
这个错误是合乎逻辑的,因为 SonarQube 正在 {Jenkins 安装路径}workspaceP
下寻找一个 .git
文件夹.它不存在.
The error is logical because SonarQube is looking for a .git
folder under {Jenkins Install Path} workspace P
. It doesn't exist.
我在互联网上四处寻找解决方案,但没有找到答案.我正在使用安装在 Windows 上的 SonarQube 5.5.
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.
你有什么想法让 SonarQube 与我的配置一起工作吗?
Do you have some idea to make SonarQube working with my configuration ?
这种情况与 Sonarqube: Missing blame information for the following files 不同,因为根本原因是我使用了两个 git 文件夹通过单个 SonarQube 分析获取.
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.
我多次访问和阅读的资源
推荐答案
根据@CSchulz 的回答,我使用 SonarQube 模块
Based on @CSchulz's answer I found the solution using SonarQube module
我将 SonarQube 配置为使用对应于我的 A
和 B
git 项目的两个子模块.每个项目都获取 git 模块的名称作为重要的 projectBaseDir
参数.
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.
这篇关于SonarQube 无法从 Jenkins 项目中获取 git blame 信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!