Access Octopus.Tentacle.PreviousInstallation.OriginalInstalledPath in script


Is it possible to access Octopus.Tentacle.PreviousInstallation.OriginalInstalledPath inside a scripttemplate that are executed on a tentacle?
I need it for a fallback solution where the nugetdeploystep could have have been runned(Note that it could also not have been runned yet), will that variable then point to the new deploy or the previous one? The short reason to why I have this setup is because i have 3large “Steps” that do alot more then just deploying the code and to lower the ammount of fallback code I got 3 fallbacks(One for each big “step”) that regardless of what it was that failed inside the steps it always makes the same fallback procedure…
My idee was to revert the code by doing a script that points the iis back to the old version, or is it a better solution?

Best regards

Hi Andreas,

The Octopus.Tentacle.PreviousInstallation.OriginalInstalledPath variable is only set for “Deploy Package” steps. It is not set for script steps, as they don’t have an install location. If you particularly want to use it, in your Deploy Package step you could set an Output-Variable to the previous install location, and use the Output-Variable in your rollback step.

Possibly a better option is to add a DeployFailed.ps1 script to your package.
To avoid duplicating the contents of this script in each package step, Script Modules are a nice way to centralize your logic.

I hope this helps. Please don’t hesitate to ask if you have any further queries.