I'm executing Sql Server 2008 commands on a remote server using Powershell. The commands are generally executing fine, however when a command fails the error code/state is not being passed back to Bamboo. Hence, Bamboo is indicating "success". The error message is being passed back, though clearly it's not an option to have to check the logs after each run.
In the deployment project I have a Script task, running as Powershell which looks something like:
Invoke-Command -computerName ${bamboo.sqlHost} -scriptBlock { sqlcmd -S ${bamboo.sqlServer} -d ${bamboo.sqlDatabase} -b -Q "SELECT TOP 3 name FROM sys.schemasXX"}
The deployment succeeds, but the log outputs:
| Msg 208, Level 16, State 1, Server IDW-SQLDB01\DEV8, Line 1 |
| Invalid object name 'sys.schemasXX'. |
|