【发布时间】:2018-01-16 07:20:28
【问题描述】:
我从事的一个项目 (eclipse/scanning) 使用 Travis 和 Sonar 进行持续集成和代码分析。
上周,我注意到构建在声纳步骤失败:
ERROR: Error during SonarQube Scanner execution
org.sonar.squidbridge.api.AnalysisException: Please provide compiled classes of your project with sonar.java.binaries property
经过一些研究,我想我会 fixed this 更新 addons: 部分(sonarqube 到 sonarcloud)并切换到使用 - mvn -q sonar:sonar 而不是 - sonar-scanner 在 script: 部分.travis.yml 文件。
但现在,通过集成测试的外部拉取请求(来自分叉)在声纳步骤由于不同的原因而失败:
$ mvn -q sonar:sonar
...
[ERROR] SonarQube server [http://localhost:9000] can not be reached
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.3.0.603:sonar (default-cli) on project org.eclipse.scanning: Unable to execute SonarQube: Fail to get bootstrap index from server: Failed to connect to localhost/127.0.0.1:9000: Connection refused (Connection refused) -> [Help 1]
这似乎与日志中的早期差异有关:
Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#Pull-Requests-and-Security-Restrictions
还有一个完全缺失的 SonarCloud 插件部分。
要查看差异,请将failed build #625(来自分叉存储库的拉取请求)与successful build #628(来自存储库中的拉取请求)进行比较。
大约一个月前,外部拉取工作没有问题,例如 build #536 通过,正确运行 Setting environment variables from repository settings、SonarCloud addon 和 sonar-scanner。
但是,后续构建,例如 build #538 已通过,但这只是因为 sonar-scanner 跳过了分析,而 exited with 0 即使它们未能运行。
虽然我可能只是在外部拉取请求上禁用 Sonar,但如果我能修复我们的存储库,这样我们就可以对内部和外部拉取请求进行集成测试和代码分析,所以
- 我原来的修复是正确的吗?
- 如果是这样,我如何让它同时处理内部和外部拉取请求?
- 如果不是,我应该如何解决原来的问题?
请注意,此问题已被 How do I get Sonarcloud to run on pull requests from forks with Travis, Maven & github 取代,How do I get Sonarcloud to run on pull requests from forks with Travis, Maven & github 专注于潜在问题,而不是试图解决某些症状。
【问题讨论】:
标签: java maven github sonarqube travis-ci