cause a plan to fail on SQL script error

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

This widget could not be displayed.

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

That worked! Thanks for the quick response.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted yesterday in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

39 views 0 1
Join discussion

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