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

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..


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

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.

Suggest an answer

Log in or Sign up to answer
Community showcase
Asked Thursday in Jira Ops

I'm John Allspaw, Ask Me Anything about incident analysis and postmortems

I'm John Allspaw, co-founder of   Adaptive Capacity Labs, where we help teams use their incidents to learn and improve. We bring research-driven methods and approaches to drive effective inciden...

732 views 7 7
View question

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