简体   繁体   English

仅在SonarQube服务器在线时才在Jenkins上执行SonarQube分析

[英]Perform SonarQube analysis on Jenkins only if SonarQube server is online

Following situation: 以下情况:

  • Having a CI server like Jenkins or Hudson 拥有像Jenkins或Hudson这样的CI服务器
  • Build jobs with Maven 3 and Java projects/artifacts 使用Maven 3和Java项目/工件构建作业
  • Each time a build is performed at the end a SonarQube analysis will be performed 每次在构建结束时执行SonarQube分析

A situation that occur, but I have no control over is, that the SonarQube server is not available. 发生了但我无法控制的情况是SonarQube服务器不可用。 The underlying cause isn't relevant for the question. 根本原因与问题无关。 If the build tries to perform the SonarQube analysis via Maven sonar:sonar or the Jenkins SonarQube plugin as post-step the SonarQube analysis causes the build to crash or have the status failed. 如果在构建后尝试通过Maven sonar:sonar或Jenkins SonarQube插件执行构建SonarQube分析,则SonarQube分析会导致构建崩溃或状态失败。 In my eyes the build is OK and SonarQube isn't the decisive factor. 在我看来,构建还可以,SonarQube不是决定性因素。

Is there any (maven/jenkins)-plugin or possibility to avoid the analysis, if the SonarQube server isn't available ? 如果SonarQube服务器不可用 ,是否有任何(maven / jenkins)插件或避免分析的可能性? The SonarQube analysis of the build shall only perform if the SonarQube server is online and can perform an analysis. 仅当SonarQube服务器在线且可以执行分析时,才会执行构建的SonarQube分析。

There is no such feature for the moment, but maybe Jenkins has some built-in feature to run a post-job only if a specific condition is met? 目前尚无此类功能,但也许詹金斯(Jenkins)具有一些内置功能,仅在满足特定条件时才可以进行后期作业? And in this case, you could just run a "curl" like command to check the availability of the SonarQube server to serve as a condition for the post-job to be executed? 在这种情况下,您可以运行类似“ curl”的命令来检查SonarQube服务器的可用性,以作为执行职位后的条件?

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

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