PostDeploy.ps1' returned non-zero exit code: 1. Deployment terminated

Recently, I have been getting the above error during a deployment at the very end of the PostDeploy.ps1 script.

It states:


So I looked around and saw that we can run the calamari run-script command ( manually to see if I get the same result.

As you can tell, the error is not happening at all when running it manually.

I am running 2018.5.1. This first started happening, IIRC, with build 2018.4.12.

Everything runs fine on the product that is being installed, it is just not encouraging to see the RED status when it is executed through the UI, but manually it is fine.

Thanks in advance.


Thanks for getting in touch! I have some info which may help here.

When you ran this script manually, did you do so running as the Octopus Tentacle’s service account? Any scripts run during deployment are executed by the account running this service.

Something else to note is that Octopus determines how the execution of a script went by reading the exit code. If your PowerShell script returns anything but a 0 it will fail.

If your script is executing correctly but is getting caught on an error, you will need to configure some error handling for the script.

If the above options do not help, please let me know. :slight_smile:

Best regards,

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.