Run previous steps on error of current step

Hi there

I’ve broken up the task of setting up SQL Mirroring into various steps:
1 - Backup Database and Transaction Log on live server (db1)
2 - Copy .bak and .trn to the mirror server (db2)
3 - execute mirror statement on mirror server (db2)
4 - execute mirror statement on live server (db1)

I also have maintenance plans in place which I don’t have control over These maintenance plans run every half hour and do things like back up transaction log etc.

The problem I’m facing is that if the maintenance plan runs on db1 such that a new transaction log file is created, step 3 fails as the .trn file (copied over in step 2) is out of date. Is there a way to get Octopus to run through these steps again without failing the entire deployment process? Essentially I’m looking for a way to “group” steps such that if one step in the group fails, you can retry all the steps in the group.

Kind regards

Ash

Hi Ash,

Thanks for the question. What would your groups be in this scenario? What is the downside of retrying the entire deployment vs retrying a group of steps?

Cheers
Shane

Hi there

The sql example I referred to could potentially have many more steps before it and if I fail the entire deployment pipeline then we have to go through a relatively long running process again. The groups I envisage are:
Backup databases
Deploy website
Set up mirroring.
etc etc.

The point is, that I need a way to replay a group of steps instead of replaying the entire deployment pipeline.

Thanks

Ash

There is also the issue of having to build in “clean up” steps to mitigate the previous failed deployment.

Hi Ash,

Ok, I think I understand. You have a potentially long deployment process that fails because part of the process can be unreliable (in this case your maintenance plan interrupts the database backup). Instead of having the re-run the entire deployment again, you would like to re-run a subset of the steps?

I think that can be accomplished with a feature we just put out called Channels. There is a blog post here: https://octopus.com/blog/octopus-deploy-3.2

What I think would work is to have a default channel and a replay channel. Your default channel would be the deployment pipeline as you have it now, and the replay channel would be just the steps you want to replay when the deployment fails.

You could scope the steps that you want to replay to your replay channel. Create your release on the default channel and if the deployment fails, you could either edit the release and set it to run on the replay channel or create a new release on the replay channel. Deploy the replay release and it will run just your replay steps.

Cheers
Shane