简体   繁体   English

SonarQube构建断路器和Jenkins质量门不一样

[英]SonarQube build breaker and Jenkins quality gates not same

I have SonarQube (v6.7) installed using sonar-build-breaker-plugin-2.2 for quality gates. 我安装了使用sonar-build-breaker-plugin-2.2进行质量门SonarQube (v6.7)。 I have Jenkins (v2.161) installed with Sonar Quality Gates Plugin (v1.3.1) installed in different Servers. 我安装了Jenkins (v2.161),并在不同服务器中安装了Sonar Quality Gates Plugin (v1.3.1)。 Below is the configuration of the Quality gates in Jenkins 以下是詹金斯(Jenkins)中质量门的配置

在此处输入图片说明

I have configured the Project key and Job status as FAILED in the job configuration. 我已经在作业配置中将项目密钥和作业状态配置为FAILED。 The problem is, when the SonarQube analysis for a project is triggered from maven using cmd prompt, it is passed successfully. 问题是,当使用cmd提示从maven触发了项目的SonarQube分析时,它成功传递了。 When the same job is triggered from Jenkins I am getting below error. 当詹金斯(Jenkins)触发相同的工作时,我将遇到以下错误。

07:03:50 [INFO] Quality gate status: ERROR
07:03:50 [ERROR] Security Rating on New Code: 4 > 1
07:03:50 [ERROR] Reliability Rating on New Code: 4 > 1
07:03:50 [ERROR] [BUILD BREAKER] Project did not meet 2 conditions
07:03:51 [INFO] ------------------------------------------------------------------------
07:03:51 [INFO] BUILD FAILURE
07:03:51 [INFO] ------------------------------------------------------------------------
07:03:51 [INFO] Total time: 02:17 min
07:03:51 [INFO] Finished at: 2019-02-06T07:03:51+01:00
07:03:51 [INFO] ------------------------------------------------------------------------
07:03:51 Waiting for Jenkins to finish collecting data
07:03:52 [ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.6.0.1398:sonar (default-cli) on project Project-company-lib: Project does not pass the quality gate. -> [Help 1]
07:03:52 org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.6.0.1398:sonar (default-cli) on project Project-company-lib: Project does not pass the quality gate.

What am I missing here? 我在这里想念什么?

Thanks in advance. 提前致谢。

The reason for the difference in report for SonarQube trigger and Jenkins Job is that, I have a configuration in SonarQube to analyse only .java,.jav files .In the SonarQube UI, Configurations --> General Settings --> Java, this configuration is available. SonarQube触发器和Jenkins Job的报告不同的原因是,我在SonarQube中有一个配置,只能分析.java,.jav文件。在SonarQube UI中,配置->常规设置-> Java,此配置可用。

The project consists of .java,.xml,.xhtml files, so in order to skip the files other than java, I have included a configuration -Dsonar.language=java in the Jenkins goal and now the report is same. 该项目由.java,.xml,.xhtml文件组成,因此为了跳过Java以外的文件,我在Jenkins目标中包含了-Dsonar.language=java配置,现在的报告是相同的。 Though this configuration is said to be deprecated, it works fine for now. 尽管此配置已被弃用,但目前可以正常使用。

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

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