Failed Deploy.ps1 is not returning failure?

This failure of the Deploy.ps1 script (which I haven’t figured out why yet) is NOT showing up as a failure. Notice the “Return code of Powershell script: 0” and all looks fine in the dashboard.

Script ‘C:\Octopus\Tentacle\Applications\MyPackage.201
1.9.28.4904\content\Deploy.ps1’ completed.
Script output:

Invoke-Expression "$CurrentPath/DatabaseManagement.exe -p Path -s Server -d TestDatabase
ERROR: Invoke-Expression : The string starting:
ERROR: At line:32 char:19
ERROR: + Invoke-Expression <<<< "$CurrentPath/DatabaseManagement.exe -p Pat
ERROR: h -s Server -d TestDatabase

ERROR: is missing the terminator: ".
ERROR: At line:33 char:18
ERROR: + Invoke-Expression <<<< "$CurrentPath/DatabaseManagement.exe -p $Databa
seDire
ERROR: ctory -s $SqlServer -d $SqlDatabase"
ERROR: + CategoryInfo : ParserError: ($CurrentPath/Da…-d TestData
base:
ERROR: String) [Invoke-Expression], IncompleteParseException
ERROR: + FullyQualifiedErrorId : TerminatorExpectedAtEndOfString,Microsoft.P
owerS
ERROR: hell.Commands.InvokeExpressionCommand
ERROR:

Return code of PowerShell script: 0

Thanks Nathan,

I’ll look into how I can detect these kinds of errors in my PowerShell host and get a bug fix out this weekend.

Paul

The best way is to catch exceptions/error in your script and “exit 1;” in the handling code