Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Can I run a deployment regardless of tests, and a second deployment only if all tests pass?

Matt Summers December 8, 2013

I'm setting up our continuous deployment for the first time and I'm a little stuck. Any pointers would be hugely appreciated.

We have two internal test servers; let's called them Test01 and Test02. I've set up a build plan that pulls from the Git repository, builds the projects, and then a linked deployment project that deploys to Test01.

What I really need is for the build artifact to always be deployed to Test01, and for it also to be deployed to Test02, but only if all tests pass.

Any idea how I could set that up? Seeing as it's a separate deployment, I'm guessing I need a separate build plan that takes the artifact from the first one and runs the unit tests? But how can I trigger one build plan from the completion of another? Can I choose to run a deployment based whether or not unit tests passed?

I've just had another look at the existing build plan and did a quick test by checking in a failed unit test. This inherently prevents the deployment, which is a problem for Test01, where we want to be able to see the deployed build regardless of tests.

Am I going to have to ignore the official deployment functionality and add my own tasks to the build plans to achieve the same result via msdeploy? I could do this in the Finally section for the Test01 deploy. Maybe that'll be easier? I guess I'm also going to have to add the Test02 tasks into the same build plan as well? Feels a bit messy..

EDIT

I think I've worked it out. Should be fine if I follow these stages:

  1. Get latest from git repository and save to artifact.
  2. Take artifact and build it. If it doesn't build, the build fails.
  3. Deploy to Test01.
  4. Run unit tests, which could fail the build.
  5. Triggered Deployment --> Deploy to Test02 when all is well.

I also have database upgrades to consider, but I should be able to factor these in as well. If building the upgrade script fails, then it all fails, otherwise I'll apply upgrades at the same time as doing the deployments.

I have no karma points, so feel free to post this as the answer so that I can mark it as the answer!

1 answer

1 vote
VikasB July 19, 2016

You can use Cucumber For Bamboo plugin. This plugin adds Cucumber parsers in Build as well ad Deployment plans. It provides options to pass or fail build if any test is failed or based on failure threshold or can just print test results in Log without affecting deployment status.
The plugin also adds new UI elements to display deployment tests, Cucumbers results and pie chart of tests. It also has features to automatically link tests with JIRA issues.
https://marketplace.atlassian.com/plugins/com.mdb.plugins.cucumberforbamboo/server/overview

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events