无法将结果发布到 Sonarqube 服务器 [英] Can't publish results to Sonarqube server

查看:17
本文介绍了无法将结果发布到 Sonarqube 服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经建立了一个 jenkins-sonarqube-github 集成工作流程,其中 git 存储库中的拉取请求会触发一个 webhook,该 webhook 会启动一个启动 SonarQube Scanner 的 jenkins 作业.问题是我无法将它发布到 SonarQube 前端,而不是 Github.
Github 结果最多只能显示 10 个 top issues,我的团队需要能够看到整个分析结果.据我所知,这只能通过前端实现.
问题:我设置了两个单独的分析工作.一个触发 github 评论行为(Sonarqube Github 插件),但我无法让另一个简单地发布到服务器.我在后一项工作中删除了所有与 github 相关的配置,但它只是以Success"结尾并且没有报告任何地方.任何帮助,将不胜感激.

I've set up a jenkins-sonarqube-github integration workflow where a pull request in the git repository triggers a webhook which starts a jenkins job that starts SonarQube Scanner. The issue is that I can't get it to publish to the SonarQube front-end, instead of Github.
Github results only show up to 10 top issues, and my team needs to be able to see the whole analysis result. As far as I know, that is only possible through the front-end.
The problem : I've set up two separate analysis jobs. One triggers the github commenting behavior(Sonarqube Github plugin), but I can't get the other to simply publish to the server. I've deleted all github-related configs in the latter job, but it just ends with "Success" and doesn't report anywhere. Any help would be appreciated.

图 1.发布到 github 而不是服务器的工作 SonarQube 扫描仪属性

sonar.projectKey=${componentName}
sonar.projectVersion=0.1
sonar.sourceEncoding=UTF-8
sonar.analysis.mode=issues
sonar.profile=My_Analysis_Profile
sonar.github.repository=${repository}
sonar.github.endpoint=https://customossendpoint/api/v3
sonar.github.login=someusername
sonar.github.oauth=somehashkey123
sonar.login=id
sonar.password=pass
sonar.github.pullRequest=${pr}
sonar.host.url=http://sonarserver:19000
sonar.issuesReport.console.enable=true 
sonar.github.disableInlineComments=false
sonar.sources=.
sonar.exclusions=
sonar.java.binaries=**/target/classes

图2.我试图调整以停止将结果发送到 github 而是发布(发送)到 sonarqube 服务器(sonar.analysis.mode=publish 至少在 sonar 6.x 中不存在)

sonar.projectKey=${componentName}
sonar.projectVersion=0.1
sonar.sourceEncoding=UTF-8
sonar.analysis.mode=issues
sonar.profile=My_Analysis_Profile
sonar.login=id
sonar.password=pass
sonar.host.url=http://sonarserver:19000
sonar.issuesReport.console.enable=false
sonar.sources=.
sonar.exclusions=
sonar.java.binaries=**/target/classes

图 3.日志:(抱歉,由于...公司问题,我不能将整个日志粘贴在这里.如果需要,我会在审查后添加整个日志.)

...
INFO: Issues mode
WARN: The use of the issues mode (sonar.analysis.mode=issues) is deprecated. This mode will be dropped in the future.
INFO: Load global settings
INFO: Load global settings (done) | time=68ms
INFO: Server id: asdfasdf
INFO: User cache: /home1/irteam/.sonar/cache
INFO: Exclude plugins: devcockpit, ldap, authgithub, authbitbucket, pdfreport, authaad, googleanalytics, governance
INFO: Load plugins index
INFO: Load plugins index (done) | time=59ms
INFO: SonarQube server 6.7.1
INFO: Default locale: "ko_KR", source code encoding: "UTF-8"
INFO: Process project properties
INFO: Load project repositories
WARN: Project doesn't exist on the server. All issues will be marked as 'new'.
...
INFO: Unit Test Coverage Sensor is started
INFO: 888/888 source files have been analyzed
INFO: Integration Test Coverage Sensor is started
INFO: Overall Coverage Sensor is started
INFO: Sensor JavaScript Squid Sensor [javascript] (done) | time=72434ms
INFO: Performing issue tracking
INFO: 19822/19822 components tracked
INFO: ANALYSIS SUCCESSFUL
INFO: Task total time: 4:31.750 s
INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS
INFO: ------------------------------------------------------------------------
INFO: Total time: 4:33.207s
INFO: Final Memory: 72M/1513M
INFO: ------------------------------------------------------------------------
Finished: SUCCESS

如您所见,它说 WARN: Project doesn't exist on the server. - 这意味着它应该创建一个新项目然后发布它.但是,它不发布任何内容,只是以成功"结尾.没有可查看的链接或任何报告文件,它只是以某种方式自行分析并死去,没有告诉任何人.我在这里做错了什么?

As you can see, it says WARN: Project doesn't exist on the server. - it means it should create a new one and then publish it. However, it doesn't publish anything and just ends with "Success". No link or any report file to view, it just somehow analyzed it for itself and died without telling anyone about it. What am I doing wrong here?

推荐答案

我遇到了类似的问题,原因是我设置了 sonar.analysis.mode=preview,目标是在不发布结果的情况下运行分析.如果您使用此模式,则可以删除或设置为适当的模式.

I had a similar issue, and reason for it was that i had set sonar.analysis.mode=preview, and the goal is to run an analysis without publishing results. You can either remove if you using this mode or set to an appropriate one.

删除它解决了我的问题.

Removing this solved my issue.

这篇关于无法将结果发布到 Sonarqube 服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆