Search code examples
azure-devopsazure-pipelinesdevopsazure-pipelines-release-pipelineblue-green-deployment

How to define release pipeline in Azure DevOps for maintainable blue-green deployment


I'm recreating our very complicated deployment process in Azure DevOps. Currently, our live environment is composed of 4 VMs behind a load balancer.

The strategy I thought about is kind of blue-green deployment, just that I'll be working on half (2) of the VMs each time.
It's not like rolling deployment since there will not be 2 versions that run simultaneously.

As soon as I finish deploying the first half and I make sure it's up and running, I'll connect it and immediately disconnect the other half to deploy the new version to it too.

I can't do blue-green for now by the book (deploying a complete separate set of VMs in the new version) since unfortunately IPs are hard-coded. The live environment will be just fine with 2 VMs only for the deployment time.

My problem is how to configure a release pipeline in Azure DevOps for this kind of solution (I use the GUI version, not YAML)? (these are stages)

DbConversionDev > FirstHalfDev > SecondHalfDev > DbConversionQA > FirstHalfQA > SecondHalfQA > DbConversionProd > FirstHalfProd > SecondHalfProd

Maybe the db conversion stage can be parallel.

It's seems complicated and hard to maintain. Any suggestions? Thanks in advance :)


Solution

  • what you could try for example is to create deployment groups, e.g. First Group and Second Group - register your agents/VMs to the groups, and in the release pipeline, create Deployment Group job for the First Group, then add the steps to verify the deployment was successful and up/running, and in the same pipeline create another Deployment Group job for the second Deployment Group. (Note: You can create an agentless job for any manual intervention)


    EDIT

    Here is the complete solution as a summary of the conversation:

    Create one Deployment Group for each Environment (e.g. Dev, QA, Prod) and tag the first half of the Agents/VMs in a Deployment Group as blue and the other half as green.

    In the release pipeline, create a Stage for each Environment (e.g. Dev, QA, Prod) and in one Stage create 2 Deployment Group Jobs for the corresponding Deployment Group (Dev Stage -> Dev Deployment Group), each Job with a different Tag: blue and green. This will make sure, that in one job half of your VMs will be affected by the deployment.

    For reusability purposes, group your Tasks in Task Groups to reuse them in your Deployment Group Jobs.