Search code examples
azureazure-service-fabriccontinuous-deploymentazure-pipelines-release-pipeline

Azure service fabric continuous deployment and rollback options after upgrade


I read about continuous deployment of service fabric with VSTS. I need a help/suggestion in this scenario where

  • I have a group of services deployed by Continuous deployment in Azure
  • Now I upgrade one service, I know that when this upgrade fails, service fabric rolls back to the previous state. Lets assume the upgrade is successful, Now I run integration tests (as a part of build definition pipeline) and it failed, in this case how to rollback this particular service alone, so that the other services remains unaffected and roll back should be automated, there should not be any manual intervention

Example: -

  1. Push your code
  2. Upgrade the deployment of service A where group of services are running
  3. Perform integration tests
  4. On failure, Rollback service upgrade of A and on success, continue to upgrade other nodes

Can this be achieved fully automated in VSTS?

I referred this link: https://learn.microsoft.com/en-us/azure/service-fabric/service-fabric-application-upgrade#rolling-upgrades-overview


Solution

  • You can use the built-in service health monitoring. By implementing custom health monitors (that run your integration tests), you can report 'unhealthy' when they fail during upgrade. You can use this information to have SF automatically roll back the upgrade. (By configuring health thresholds.) You can also control upgrades manually, for example by using PowerShell Start-ServiceFabricApplicationUpgrade.

    Scott Hanselman gave a good presentation about this in action here. Another example here.