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

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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published May 18, 2017 in Bamboo

FAQ: How to Upgrade Bamboo Server

Bamboo 5.9 will no longer be supported after June 12, 2017. What does this mean? As part of our End of Life policy, Atlassian supports major versions for two years after the first major iteratio...

1,801 views 0 6
Read article

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