我遵循了这段视频https://www.youtube.com/watch?v=jh7utASgKj4,将声纳古柏与詹金斯结合在一起。但是,通过sonarqube服务器扫描代码时,出现权限不足错误。 sonarqube服务器的版本是6.7。我该如何解决这个问题?
这是jenkins项目中的分析属性
# Required metadata
sonar.projectKey = test-sonar
# Path to source directory
sonar.sources = /var/jenkins_home/workspace/$JOB_NAME/test-sonar/src
# bind sonar.java.binaries property
sonar.java.binaries=/var/jenkins_home/workspace/$JOB_NAME/test-sonar/target/classes
这是控制台的输出。
INFO: SCM provider for this project is: git
INFO: 16 files to be analyzed
INFO: 16/16 files analyzed
INFO: 5 files had no CPD blocks
INFO: Calculating CPD for 8 files
INFO: CPD calculation finished
INFO: Analysis report generated in 132ms, dir size=124 KB
INFO: Analysis reports compressed in 48ms, zip size=61 KB
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 48.028s
INFO: Final Memory: 15M/304M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution
ERROR: Insufficient privileges
ERROR:
ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.
WARN: Unable to locate 'report-task.txt' in the workspace. Did the SonarScanner succedeed?
ERROR: SonarQube scanner exited with non-zero code: 1
答案 0 :(得分:0)
请确保您在Sonar插件中为Jenkins配置了具有访问声纳服务器特权的Sonarqube用户ID和密码(执行分析权限)。禁用匿名访问声纳时,对于5.3及更高版本,可能会出现此错误。
答案 1 :(得分:0)
如果您正在通过Jenkins的Execute shell插件运行Sonar Analysis,则需要提供一个用户的用户名密码,该用户在您尝试访问的SonarQube服务器上具有Execute Analysis权限。
要在外壳程序中提供用户名,您可以使用
-Dsonar.login=yourLoginName -Dsonar.password=*****
要设置“执行分析”权限,您可以要求DevOps团队授予您访问权限,或者如果您正在调查中,
Goto Administration > Security > User/Groups.