How to demand multiple agent machines in Azure devops pipeline pool?

£可爱£侵袭症+ 提交于 2021-02-19 07:32:32

问题


I'm looking if I can specify a list of agents in Agent pool demands? In UI azure pipeline has only two options equals and exists. So, I tried adding two demands but pipeline takes only first demand

Pipeline UI

The same in yaml is as follows,

pool:
  name: AWS Pool
  demands:
  - Agent.Name -equals simLin02
  - Agent.Name -equals ubuAgent01

I would like to know if there is any logical way of specifying the list of agent machines in yaml like following or any other alternatives where I can pass a list of agent names(specific agent names because not all agents in the pool have desired capability) for the pipeline to choose from.

pool:
  name: AWS Pool
  demands:
  - Agent.Name -in (simLin02, ubuAgent01)

回答1:


Sorry but as I know Azure Devops doesn't support specifying the list of agent machines using the logical way above. Instead we can define user-defined capabilities if we want to pass a list of agents for the pipeline to choose from. See:

For example: If we define one custom capability called RunTest for agents simLin02 and ubuAgent01, then we can easily use something like this to choose the list which contains these two agents:

pool:
  name: Default
  demands: RunTest

Since only agents simLin02 and ubuAgent01 contain the RunTest capability, it will pick one of them to run the pipeline. It actually has same effect like - Agent.Name -in (simLin02, ubuAgent01) whose syntax is not supported.



来源:https://stackoverflow.com/questions/63629214/how-to-demand-multiple-agent-machines-in-azure-devops-pipeline-pool

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!