简体   繁体   中英

Is it possible to create a sonarqube quality gate condition to catch reduction in the code coverage in latest sonarqube(Version 6.7)?

I need to create a sonarqube quality gate condition that fails a build if the code coverage drops from the last version. The leak period is now set as the 'previous_version'. I know that there was a delta analysis feature in the older versions of sonarqube. But I think this is no longer available.

For example, in the previous build the coverage was 30% and in the current build it is 29%. So there is a drop in the overall coverage. In this case I need to fail the build. Again I cannot do absolute comparison(like Coverage < 30 etc.) because the coverage varies in different projects and I am doing a global configuration.

I am using sonarqube 6.7 LTS Community version

Is this even possible? If not is there a different way?

I guess I found a way around this. I setup a rule like this in the quality gate: 在此处输入图片说明

and added more code to the project without tests.

Then I ran the analysis and my quality gate failed with following message:

在此处输入图片说明

(Ignore the coverage on new code rule on the left)

I think the key here was to set the "Over leak period" checkbox ticked

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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