farmer icon indicating copy to clipboard operation
farmer copied to clipboard

Are rollbacks supported in any capacity?

Open NatElkins opened this issue 3 years ago • 3 comments

I am using Farmer via the SAFE stack template. When I first ran the deploy target, one part of it failed because the app name I had chosen was already taken. It looked something like this:

image

I just changed the name and it solved the issue. But the application insights and app service plans still had been created (using the previous name) and I had to go in and delete them. I think it's preferable, if possible, to have the resources fail/rollback/be deleted if any part of the deployment fails. Is such a thing possible?

NatElkins avatar Nov 15 '20 22:11 NatElkins

@NatElkins That's kind of an ARM thing - maybe have a look at the deployment behaviour of ARM and see if there's an option for this, if there is, we could bake that in.

isaacabraham avatar Nov 16 '20 10:11 isaacabraham

I see there's something like that: https://docs.microsoft.com/en-us/azure/azure-resource-manager/templates/rollback-on-error

NatElkins avatar Nov 17 '20 00:11 NatElkins

@NatElkins we could certainly add this. In the future, we're going to probably redesign the deployment API anyway (there's already an experimental branch) and this could be part of that i.e. supply an "auto rollback" argument.

For now, we could add a simple "rollback" command which you could manually call based on the result of the call to deploy e.g.

match template |> Deploy.execute "my-rg" [] with
| Ok _ ->
    "happy days!"
| Error _ ->
   template |> Deploy.rollback "my-rg"
   "failed - rolled back"

What do you think?

isaacabraham avatar Dec 12 '20 17:12 isaacabraham