cause a plan to fail on SQL script error

Russ Collins May 7, 2013

I am new to bamboo but have not been able to find info anywhere on what I am trying to do.

In a task I am running a powershell script to deploy database changes. In that PS script it calls invoke-sqlcmd to execute a sql script. However, if that sql script fails for any reason the entire task still completes successfully. Is there any way to cause the task to fail if the script errors?

Thanks

1 answer

1 accepted

0 votes
Answer accepted
PiotrA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 7, 2013

Hello Russ,

I know that Bamboo uses return code for Script Task to determine if it should fail the build. So one solution that comes to my mind would be to tweak your powershell script to detect if invoke-sqlcmd has failed/errored, and if so - exit 1 or exit something different than 0. 0 return code means to Bamboo "I'm a successful task, please don't fail me".

Is that helpful to you?

regards

Russ Collins May 8, 2013

That worked! Thanks for the quick response.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events