Today's Octopus Deploy release includes support for a
DeployFailed.ps1 script, a feature I mentioned in a recent blog post about how Octopus handles rollbacks.
During a deployment, Tentacle normally runs the following steps:
- Extracts the package from NuGet
- Runs XML config transforms
- Replaces XML config
- Configures IIS websites
If steps 2-7 fail, Tentacle will now look for a
DeployFailed.ps1 script, and invoke that. It will have access to the same variables that the other PowerShell scripts get. This is a good place to put recovery actions.
Note that if step 1 fails, the
DeployFailed.ps1 won't be called. There are a few reasons for this:
DeployFailed.ps1might not have been extracted anyway
- Files it depends on may not have been extracted
- Tentacle checks for free disk space prior to installing a package, so this should be pretty rare in the first place
- Extracting the package is an isolated task, so there's nothing to recover from in the first place
One feature that would be nice is to pass the path to the last installed package, which your recovery script could use when rolling back. Tentacle doesn't have enough information to do that yet, but it will when Auto-purge Tentacles is implemented, since both require keeping a list of previously installed applications.
Octopus Deploy is used by thousands of developers across the globe, from small companies to large enterprises. Find out if it meets your deployment automation needs by taking advantage of our free 30-day trial. You can spin up an instance with just a few clicks!