Multi-configuration Deployment Group Jobs with the Multipliers variable? - azure-devops

I'm trying to re-use a Deployment Group Job and execute it for each member of a ClientID list, but it is not working. The name of the stage will also be used in my tasks.
As described on this page...
https://learn.microsoft.com/en-us/azure/devops/pipelines/process/phases?view=azure-devops&tabs=classic
I've create two variables:
ClientID
client1, client2, client3
Multipliers
ClientID
The stage only has a Deployment Group Job and not an Agent Job because after the deploy I have tasks to run on the self-hosted servers. I need to stop and remove a service, copy files, register and restart a service.
There are no other options on the Stage or the Deployment Group Job for multipliers. (There is the "multiple" options for parallel deployments to servers within the group but that is unrelated as far as I know.)
If I add an Agent Job then I can see that it has the "Multi-configuration" and "Multipliers" options that other articles mention. On a deploy the agent job executes multiple times as expected but not the deployment group job.
The article above talks about "Multi-configuration deployments", so I'm I wrong to think the Deployment Group Job should work that way?
Any help is appreciated. Thanks.

I am afraid that using multipliers in the deployment groups is not feasible.
According to the definition of Multi-configuration in the agent job : each configuration will use a single agent.
But, in effect, a deployment group is just another grouping of agents, much like an agent pool.It could not assign a single agent to each configuration.
So I think that multipliers are not available in the deployment groups.If you want to use multipliers, then you need to use agent job.

Related

Can I replace Deployment Group name using Library variables in Azure DevOps

I want to use Library Varibles as Azure Deployement Group name in Azure Dev-Ops Release pipelines , is it possible ? And Is it a good practise to do it ?
Purpose : I want to use same pipeline and same stage to deploy on different environments , so that If I change Deployment Group Name (Dev,QA,UAT) in library variable , it will deploy to that env.
I am afraid that the Deployment Group name field doesn't support to use Pipeline Variable(e.g. Library Variable) to define the name.
It currently only supports hard-coded deployment group name in Deployment Group job.
For a workaround, you can add multiple deployment group jobs with different deployment group name. Then you can set the condition to determine which job can run
based on the Library variable value.
Here is an example:
On the other hand, I can fully understand your requirement, I suggest that you can create a suggestion ticket in the Developer Community.

How to run a Deployment Group Job in one of the matching servers?

I have multiple local on-prem agents that can run a particular deployment group job (for the purpose of load balancing). I want only the first available one to run the job and not all of them. Which setting of the Deployment Group Job I can use to do that? My only options seems to be "Multiple" and "Single at a time" both of which run the jobs on all servers matching the Required Tags.
I want only the first available one to run the job and not all of them. Which setting of the Deployment Group Job I can use to do that?
There is an option for the Release pipeline with Deployment Group job Required tags:
Then we just need to add the tag to the machine, which we want to deploy:
Now, the release pipeline will run a Deployment Group Job in one of the matching servers.
Update:
I do have the required tag, but on two agent servers. I want the Job
to pick only one of the two matching servers and run the job on it
instead of running it on both.
As workaround, you could create a private agent pool and add two or more agents in it. Those agents are deployed on different machines. With this way, the pipeline will executed on one of the agent.
https://learn.microsoft.com/en-us/azure/devops/pipelines/agents/v2-windows?view=azure-devops&viewFallbackFrom=vsts

Multiple Deployment Groups on Single Target Server - Any potential issues?

We currently have 4 Azure DevOps team projects that require two Deployment Groups to be created for their SIT and UAT release pipelines. All 4 team projects will share the two Deployment Groups, the idea being to create the deployment group from one team project and then sharing or extending it to the other 3 (which I believe is common practice).
My main concern though is that due to some budget constraints, the decision has been taken to create both SIT and UAT Deployment Groups on a single target server. Much as I strongly believe this is probably not best practice, are there any technical reasons why this cannot or shouldn't be implemented?
In simple terms, deployment groups is that:
A deployment group is a logical set of deployment target machines that
have agents installed on each one. Deployment groups represent the
physical environments; for example, "Dev", "Test", "UAT", and
"Production". In effect, a deployment group is just another grouping
of agents, much like an agent pool.
We support registering the same machine to multiple deployment groups. However you would need to edit the agent name in our PS "registration script" provided in the UI. Or log into the machine physically and execute the script in a different folder than the default one specified in the script.
Normally, we set up deployment groups with multiple agents and run deployment just to target agent according to requirements.
What you can do is assign tags to deployment agents and use tags to assign releases to specific agents.
In summary, it's able to register the same machine/server to multiple deployment groups if you insist on.
But due to server performance, environmental isolation , Disaster Tolerance and other factors.

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 :)
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.

What are the differences between an Agent Job and a Deployment Group Job in Azure DevOps?

What are the differences between an Agent Job and a Deployment Group Job in Azure DevOps? What are the reason to create one or the other?
What are the differences between an Agent Job and a Deployment Group
Job in Azure DevOps?
Agent job:
Run steps on an agent which in an agent pool.
Deployment group jobs:
Run on machines in a deployment group.
These are the definition of them. You can see that, the fundamental difference between them is that the target when running the job are different.
For agent job, it can only run on one target at a time (unless set up parallel to run on multiple targets at a time, but parallel is essentially multiple jobs). And deployment group job is, since the deployment group is multiple machines are bound in a group, it can run a job on multiple machines at a time.
In the usage scenario, Agent job can used in both Build and Release pipeline. But for Deployment agent job, it can only be used in Release pipeline for application/project deploy.
What are the reason to create one or the other?
In build pipeline, it should no doubt that you can only use Agent job (or Agentless) job.
I think what you concerned should be the usage in Release pipeline. As I mentioned above, these different jobs can all be used in Release pipeline, and they can all be used for project deployed.
But in terms of specific use, it depends on the task you will use and the number of target servers you want to deploy to.
Agent job:
If your deployment target server number less than 5 objects, and need to deploy to multiple machines at the same time, you can set up a parallel job for Agent job. The Agent job may take a little longer time than Deployment group job. But because the number of deployed targets is not too much, the difference is not obvious.
Deployment group job:
For medium and large companies, the Deployment target objects are generally more than 10, even 100. It is most appropriate to use Deployment group job, because it can be deployed on different machines in one job.
In release, recommend you use Deployment group job if you have multiple targets to deploy to: