Tentacle error handling with Script Modules

Greg Bielleman's Avatar

Greg Bielleman

22 Feb, 2013 03:25 AM

Hi OctopusDeploy gurus

I've created a PSM1 that contains some common functions I use within out deploys,
My deploy.ps1 has the $ErrorActionPreference set to stop.
When i run my deploy.ps1 through standard powershell the script stops if an error occurs in any of the modules functions throw an error. fail, but when tentacle.exe is the host this it continues.
The version of tentacle used in this test was 1.2.3.1476

Is there a workaround for this?

  1. 1 Posted by Greg Bielleman on 22 Feb, 2013 03:31 AM

    Greg Bielleman's Avatar

    Hmm, I should have read this properly before i clicked submit...ir gibberish.. But hopefully you get the idea - which is errors thrown in script modules do not stop the deploy.ps1 when run through Tentacle when the ErrorActionPreference is set to Stop. Is there a way to make it behave the same way as powershell.exee

  2. Support Staff 2 Posted by Paul Stovell on 22 Feb, 2013 06:45 AM

    Paul Stovell's Avatar

    Hi Greg,

    Do you get the same error when running your scripts via the Tentacle command line?

    http://octopusdeploy.com/blog/testing-powershell-scripts

    One difference is that in Octopus we don't tell PowerShell to run the file - we actually load the file into a string and invoke it that way. So perhaps this is why the behavior is different.

    Paul

  3. 3 Posted by Greg Bielleman on 22 Feb, 2013 09:54 AM

    Greg Bielleman's Avatar

    Hi Paul,

    Yes mate, same behaviour with the tentacle command line.

    Cheers
    Greg

  4. Support Staff 4 Posted by Paul Stovell on 22 Feb, 2013 10:04 AM

    Paul Stovell's Avatar

    Hi Greg,

    Thanks for the update. I've added it to this trello item to take a look at:

    https://trello.com/card/alternative-powershell-execution-modes/4e90...

    Paul

  5. 5 Posted by Greg Bielleman on 26 Feb, 2013 12:33 AM

    Greg Bielleman's Avatar

    Hi Paul

    Just an FYI

    The workaround for this is to set the ErrorActionPreference within the
    module as well as the script and then all is well

    Cheers
    Greg

  6. Paul Stovell closed this discussion on 28 Feb, 2013 05:21 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac