如何使用Jenkins配置SonarQube GitHub插件 [英] How To Configure SonarQube GitHub Plugin With Jenkins

查看:565
本文介绍了如何使用Jenkins配置SonarQube GitHub插件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们对利用团队中的GitHub集成非常感兴趣:
http ://docs.sonarqube.org/display/PLUG/GitHub+Plugin



我们使用Jenkins作为CI服务器,并且已经有了GitHub Pull Request Builder在那里工作。我们也一直在使用SonarQube进行分析,但对预览或增量模式以及GitHub集成并没有太大的好运。目前的版本是SonarQube 5.1.1和GitHub插件版本1.0.1。



我们在SonarQube上安装了插件并配置了我们的GitHub Enterprise API。我们已经尝试在Jenkins和Maven中使用SonarQube Runner,以便按照 travis.sh 脚本的指导进行操作:
https://github.com/SonarSource/sonarqube/blob/master/travis.sh



我们看到Sonar集成显示在GitHub上,但它总是成功的(我们正在处理大量的遗留代码库并希望看到很多输出)。 >

我们的javascript和java分析之间的一致性是,我们似乎没有获得任何文件索引,并且使用GitHub Plugin InputFile Cache传感器代替Javascript或Java传感器,我们已经习惯看到在一个完整的分析。

  00:01:57.532 13:12:31.109信息 -  0索引文件
00:01:57.533 13:12:31.110信息 - 25784文件因包含/排除模式而被忽略
00:01:57.535 13:12:31.112 INFO - js的质量配置文件:S onar way
00:01:57.758 13:12:31.334 DEBUG - 'SCM Sensor'在预览模式下跳过
00:01:57.758 13:12:31.335 DEBUG - 'CPD Sensor'在预览模式下跳过
00:01:57.759 13:12:31.336 DEBUG - Sensors:Lines Sensor(wrapped) - > GitHub插件InputFile缓存
00:01:57.759 13:12:31.336信息 - 传感器线路传感器(包装)
00:01:57.759 13:12:31.336信息 - 传感器线路传感器(包装) )|时间= 0ms
00:01:57.759 13:12:31.336信息 - 传感器GitHub插件InputFile缓存
00:01:57.759 13:12:31.336信息 - 传感器GitHub插件InputFile缓存(done)时间= 0ms
00:01:57.759 13:12:31.336调试 - 没有以前的分析,跳过问题跟踪
00:01:57.763 13:12:31.340信息 -
00:01: 57.763
00:01:57.763 -------------问题报告-------------
00:01:57.763
00:01:57.763未分析文件
00:01:57.763
00:01:57.763 ----------------------- --------------------
00:01:57.763
00:01:57.763
00:01:57.763 13:12 :31.340信息 - 将问题导出到/data/jenkins/workspace/mygea-mygeaviation-pullrequests/.sonar/sonar-report.json
00:01:57.766 13:12:31.343信息 - 分析成功
00:01:57.767 13:12:31.344 DEBUG - Post-jobs:GitHub Pull请求发布发布者
00:01:57.767 13:12:31.344 INFO - 执行作业后类org.sonar.plugins.github。 PullRequestIssuePostJob

我们是否缺少一些简单的东西?

分析属性如下:

  sonar.projectKey = mygea-ux-pullrequests 
sonar.projectName = myge a-ux-pullrequests
sonar.projectVersion = 1.0.0
sonar.sourceEncoding = UTF-8
sonar.language = js
sonar.sources =。/
sonar.verbose = true
sonar.exclusions = static / ge_ux / ** / *,node_modules / ** / *,custom-login / custom-login-cfm / iids / ** / *,custom-login / custom-login-honda / iids / ** / *,custom-login / custom-login-ge / iids / ** / *,static / ge.com.2013 / components / ** / *,static / ge.com .2013 / widgets / ** / * .min.js,testFiles / ** / *,coverage / ** / *,gulpfile.js,test-tmp / ** / *,extend.js,index.js,static /ge.com.2013/js/**/*.min.js
sonar.analysis.mode =预览
sonar.issuesReport.console.enable = true
sonar.forceUpdate = true
sonar.github.pullRequest = $ ghprbPullId
sonar.github.repository = mygea / mygeaviation
sonar.github.login = *****
sonar.github.oauth = *****
sonar.github.endpoint = *****

任何对此的援助将非常感谢!这是一个非常棒的插件,我们认为这将帮助我们控制技术债务。

解决方案

Google集团在此提供了答案:
https://groups.google.com/forum/#!topic/sonarqube/eoTmLMyDrtA



分析会根据拉取请求中的文件自动进行过滤。我们正在使用仅在pom.xml和readme文件中进行更改的pull请求进行测试。一旦引入了功能更改,GitHub合并请求视图中的所有内容都按照预期点亮。



用户错误!按照设计进行工作。



感谢Julien推动我们朝着正确的方向前进。


We are very interested in leveraging the GitHub integration on my team: http://docs.sonarqube.org/display/PLUG/GitHub+Plugin

We use Jenkins as our CI Server and already have the GitHub Pull Request Builder working there. We have also been using SonarQube for analysis but have not had much luck with the preview or incremental modes and GitHub integration. Current versions are SonarQube 5.1.1 and GitHub Plugin version 1.0.1.

We have the plug-in installed on SonarQube and have our GitHub Enterprise API configured. We have attempted using the SonarQube Runner in Jenkins and Maven to get this to work following the travis.sh script as a guide: https://github.com/SonarSource/sonarqube/blob/master/travis.sh

We see the Sonar integration show up on GitHub, but it is always successful (we are working with large, legacy code bases and expect to see a lot of output).

The thing that is consistent between our javascript and java analysis is that we don't seem to be getting any files indexed and the GitHub Plugin InputFile Cache sensor is used instead of Javascript or Java sensors we are used to seeing during a full analysis.

00:01:57.532 13:12:31.109 INFO  - 0 files indexed 
00:01:57.533 13:12:31.110 INFO  - 25784 files ignored because of inclusion/exclusion patterns
00:01:57.535 13:12:31.112 INFO  - Quality profile for js: Sonar way
00:01:57.758 13:12:31.334 DEBUG - 'SCM Sensor' skipped in preview mode
00:01:57.758 13:12:31.335 DEBUG - 'CPD Sensor' skipped in preview mode
00:01:57.759 13:12:31.336 DEBUG - Sensors : Lines Sensor (wrapped) -> GitHub Plugin InputFile Cache
00:01:57.759 13:12:31.336 INFO  - Sensor Lines Sensor (wrapped)
00:01:57.759 13:12:31.336 INFO  - Sensor Lines Sensor (wrapped) (done) | time=0ms
00:01:57.759 13:12:31.336 INFO  - Sensor GitHub Plugin InputFile Cache
00:01:57.759 13:12:31.336 INFO  - Sensor GitHub Plugin InputFile Cache (done) | time=0ms
00:01:57.759 13:12:31.336 DEBUG - No previous analysis, skipping issue tracking
00:01:57.763 13:12:31.340 INFO  - 
00:01:57.763 
00:01:57.763 -------------  Issues Report  -------------
00:01:57.763 
00:01:57.763   No file analyzed
00:01:57.763 
00:01:57.763 -------------------------------------------
00:01:57.763 
00:01:57.763 
00:01:57.763 13:12:31.340 INFO  - Export issues to /data/jenkins/workspace/mygea-mygeaviation-pullrequests/.sonar/sonar-report.json
00:01:57.766 13:12:31.343 INFO  - ANALYSIS SUCCESSFUL
00:01:57.767 13:12:31.344 DEBUG - Post-jobs : GitHub Pull Request Issue Publisher
00:01:57.767 13:12:31.344 INFO  - Executing post-job class org.sonar.plugins.github.PullRequestIssuePostJob

Are we missing something simple?

Analysis properties are as follows:

sonar.projectKey=mygea-ux-pullrequests
sonar.projectName=mygea-ux-pullrequests
sonar.projectVersion=1.0.0
sonar.sourceEncoding=UTF-8
sonar.language=js
sonar.sources=./
sonar.verbose=true
sonar.exclusions=static/ge_ux/**/*, node_modules/**/*, custom-login/custom-login-cfm/iids/**/*, custom-login/custom-login-honda/iids/**/*, custom-login/custom-login-ge/iids/**/*, static/ge.com.2013/components/**/*, static/ge.com.2013/widgets/**/*.min.js, testFiles/**/*, coverage/**/*, gulpfile.js, test-tmp/**/*, extend.js, index.js, static/ge.com.2013/js/**/*.min.js
sonar.analysis.mode=preview
sonar.issuesReport.console.enable=true
sonar.forceUpdate=true
sonar.github.pullRequest=$ghprbPullId
sonar.github.repository=mygea/mygeaviation
sonar.github.login=*****
sonar.github.oauth=*****
sonar.github.endpoint=*****

Any assistance on this would be much appreciated! This is an awesome plug-in and we think it will really help us get our technical debt under control.

Josh

解决方案

The answer to this was provided in the Google Group here: https://groups.google.com/forum/#!topic/sonarqube/eoTmLMyDrtA

The analysis is automatically filtered based on the files in the pull request. We were testing with pull requests that only had changes in pom.xml and readme files. Once a functional change was introduced, everything lit up on the GitHub Pull Request view as expected.

User error! Working as designed.

Thanks to Julien for pushing us in the right direction.

这篇关于如何使用Jenkins配置SonarQube GitHub插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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