This is a bit old but I thought I'd add what I do in my process in octo.
I run rolling deploy with child steps.
I have a powershell step to record the previous IIS path in an output variable.
Import-Module 'WebAdministration'
Write-Host ('IIS:\Sites\Online-' + $OctopusParameters["Octopus.Environment.Name"])
$formerPath = (Get-ItemProperty -Path ('IIS:\Sites\Site-' + $OctopusParameters["Octopus.Environment.Name"]) -Name physicalPath)
if($formerPath.length -gt 0) {
Set-OctopusVariable -Name 'FormerIISPath' -Value $formerPath
Write-Host "Former path is '$formerPath'"
}
I then do what I need to do for my deployments and have a manual step to review each rolling deploy.
If that manual step gets cancelled I have an on fail set of child items which has the following powershell script.
$formerPath = $OctopusParameters["Octopus.Action[Set previous path].Output.FormerIISPath"]
if($formerPath.Length -gt 0) {
Import-Module 'WebAdministration'
$currentPath = (Get-ItemProperty -Path ('IIS:\Sites\Online-' +
$OctopusParameters["Octopus.Environment.Name"]) -Name physicalPath)
if($currentPath -ne $formerPath) {
Set-ItemProperty -Path ('IIS:\Sites\Site-' + $OctopusParameters["Octopus.Environment.Name"]) -Name 'physicalPath' -Value $formerPath
Write-Host "Deployment failed, reverted to former path - '$formerPath'"
}
}
This will revert all the servers back to whatever they were showing before.
I want to add that I also use the default package location and never overwrite previous files. The other option is to use the REST API on octo to trigger the previous successful deployment (param is on octo) if your deployment steps are more complex but for me I want to fail back fast.