Deploy build only if code coverage is above threshold

Hi,

Is it possible to trigger a deploy job for a build only if the clover report shows above a certain percentage of coverage?

 

Thanks!

1 answer

1 accepted

1 vote
Accepted answer

Hi, 

you could use targetPercentage option to fail the build and then stop deployment. Please refer to the documentation for more information:

 

Best regards,

Grzegorz Lewandowski

Thanks for the answer!

I've looked into the links you send and I don't understand how to configure it via Bamboo.
Do I need to have access to the server for that? Isn't there a way to do it from the Bamboo interface?

 

Thanks again

 

Ok, sorry I blindly assumed that you're using manual integration with Clover and that's probably not the case and you're using automatic one. Such settings, as you require, are not available in Bamboo Administration screens since it's Clover product configuration not a Bamboo one. I can't be sure here, but you're probably using Maven to build your project, am I right? In that case you'd have to configure manually Clover with your poms, please refer to the [docs |https://confluence.atlassian.com/display/CLOVER/Basic+usage] how to achieve this.

I will try it! thanks!

Shortly: 1) Add maven-clover2-plugin to your pom.xml. 2) Define <targetPercentage> option. 3) Maven task should run: clean clover2:setup test clover2:aggregate clover2:clover clover2:check (I assume that you'd like to see coverage reports as well) 4) In Bamboo you shall choose "Clover is already integrated into this build". 5) Your deployment task trigger shall depend on a successful build task.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Monday in Confluence

Organizing your space just got easier - Page Tree Drag & Drop is here

Hi Community! I’m Elaine, Confluence Product Manager. You may have read my earlier post about page tree in space navigation sidebar. I'm excited to share another improvement that helps you organize ...

158 views 3 5
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you