Will a job in a stage start if the previous stage has some failed jobs?
Asked by Guillaume Lucazeau:

Hello,

I have a plan for Selenium tests with three stages and different jobs, something like this:

Stage 1

- job 1.1: build tests (Maven), deployes to Tomcat, starts Tomcat

Stage 2:

- job 2.1: executes TestSuiteA

- job 2.2: executes TestSuiteB

- job 2.3: executes TestSuiteC

Stage 3:

- job 3.1: stops Tomcat, backup logs, undeployes webapp

We made different jobs in Stage 2 because Selenium takes a long time to run, so if we update a test case class, and want to test its execution on Bamboo, we can disable some jobs and run only the Test Suite that contains this test case to make the execution faster.

But it seems that if a job fails in Stage 2, the job in Stage 3 does not run. Is it the expected behavior?

This plan is also supposed to launch a child plan when completed but most of the times it doesn't launch it (apparently when the parent plan is launched manually the child plan is launched, but when the parent plan is triggered by a cron job the child plan is not launched). Could it be related?

I looked in the log file but didn't see anything wrong.

Thank you for your help!


Answers:
author: Przemek Bruski
body: Yes, that's an expected behaviour. New stage will never be started if the previous one hasn't succesfully finished.

Maybe you could define your app as a shared artifact in Job 1.1, deploy it to separate Tomcats in 2.x Jobs and have Tomcat shutdown as a finalising task in all 2.x Jobs?

comments: author: Guillaume Lucazeau
body: I could do that but the problem is that deploying our webapp (which is in the Maven repository), with our custom Maven plugin, creates some tables and then takes something like 15 minutes to start. I would like to avoid to do that 5 times ( we have 5 Test Suites... so far) when we run the full plan. It seems that there is no solution to my problem.

When you're talking about "finalising task", are you talking about this: <http://confluence.atlassian.com/display/BAMBOO/Configuring+Tasks> ? We are still using Bamboo 3.0.1 so I apparently will have to upgrade it before try it.


author: Przemek Bruski
body: That's right, I was talking about a newer Bamboo version. With 3.0.1, you need to handle Tomcat shutdown in the test script you launch.

To handle your original setup, you'd need a 'Finalising Job' or a 'Finalising Stage' concept that is not present in Bamboo.


author: Guillaume Lucazeau
body: Thank you Przemek for the clarification. Is there a chance that this "finalising stage/job" will be available in a future Bamboo version?

<br />

I was going to ask about my dependencies issues but I've just seen that in the documentation (I don't know how I missed it): "You may want to trigger a Plan build when another Plan's build has successfully completed". So that's why my child plan doesn't run. Everything makes sense now, thank you!


author: Przemek Bruski
body: I've added [an improvement request](https://jira.atlassian.com/browse/BAM-10444) for that. It does look like a valid use case complementing the processing paralellisation feature that became available when Stages were introduced. Vote and Watch ;-)


author: Guillaume Lucazeau
body: Thanks, I will!