Search code examples
azureyamlazure-pipelinesdevopsagent

Azure Devops "Deployment Targets" ON PREM


I am trying to do something in Azure Devops (YAML) that I would achieve in Octopus Deploy using deployment targets and roles. Whilst deploying on prem.

We segregate our agent pools into App/Environment pots. So that from a permissions perspective each agent in the pool can only deploy to a given environment and for a given app (using specific local agents).

I am expecting to be able to say I "run this deployment for all the agents that meet some criteria" be that all the agents in a pool, or that have a demand or capability.

Given each pool is for an app and environmental I want to be able to say 'run this deployment for them all'.

I don't want to have hard code my pipeline or give it knowledge of where applications are deployed.

Like I say in Octopus you just specify a role and all the deployment targets that have that role are used.

Help!


Solution

  • you just specify a role and all the deployment targets that have that role are used

    There is no such role in Azure DevOps. As a workaround, you can use Environment in a deploy job with rolling deployment strategy. You can add different tags to the VMs inside the environment, which give you a way to target a set of specific VMs in an environment for deployment.

    jobs: 
    - deployment: VMDeploy
      displayName: VMDeploy
      environment:
        name: Dev
        resourceType: VirtualMachine
        tags: tag1
      strategy:
        rolling:
          maxParallel: 3  
          deploy:
            steps:
    

    In the above example, up to 3 VMs in the environment named "Dev" can be deployed in parallel, and these VMs all have "tag1".