简体   繁体   English

如何使用Jenkins配置SonarQube GitHub插件

[英]How To Configure SonarQube GitHub Plugin With Jenkins

We are very interested in leveraging the GitHub integration on my team: http://docs.sonarqube.org/display/PLUG/GitHub+Plugin 我们对利用我团队中的GitHub集成非常感兴趣: 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. 我们使用Jenkins作为CI服务器,并且已经在其中运行GitHub Pull Request Builder。 We have also been using SonarQube for analysis but have not had much luck with the preview or incremental modes and GitHub integration. 我们还一直在使用SonarQube进行分析,但是在预览或增量模式以及GitHub集成方面运气不佳。 Current versions are SonarQube 5.1.1 and GitHub Plugin version 1.0.1. 当前版本是SonarQube 5.1.1和GitHub插件版本1.0.1。

We have the plug-in installed on SonarQube and have our GitHub Enterprise API configured. 我们在SonarQube上安装了插件,并配置了GitHub Enterprise API。 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 我们已经尝试在Jenkins和Maven中使用SonarQube Runner来按照travis.sh脚本作为指导使其工作: 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). 我们看到Sonar集成出现在GitHub上,但是它总是成功的(我们正在使用大型的旧代码库,并期望看到很多输出)。

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. 我们的javascript和Java分析之间的一致性是,我们似乎没有索引任何文件,并且使用了GitHub Plugin InputFile Cache传感器而不是我们在全面分析期间看到的Java或Java传感器。

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 答案是在Google网上论坛的此处提供的: 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. 我们正在使用仅在pom.xml和自述文件中进行过更改的请求请求进行测试。 Once a functional change was introduced, everything lit up on the GitHub Pull Request view as expected. 引入功能更改后,所有内容都会按预期在GitHub Pull Request视图上点亮。

User error! 用户错误! Working as designed. 按设计工作。

Thanks to Julien for pushing us in the right direction. 感谢Julien推动我们朝着正确的方向前进。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM