如何指定给定代理池中可用的代理列表,并使用 yaml [Azure 管道] 从该列表中获取任何可用代理

How can I specify list of agents available in a given agent pool and fetch any available agent from that list using yaml[Azure pipeline]

我想指定代理列表,例如:我在此范围内有从 agent1 到 agent10 和 agent40 到 agent60 可用的代理 我想为管道执行获取任何可用的代理。所有这些代理都在同一个池中。

目前我正在参数化代理值并在队列时间内传递它,如下所示:

并在yaml文件中获取,如下所示:

抱歉,据我所知,Azure Devops 不支持指定代理计算机列表。

我的理解可以使用 demands

文档中提供的注释来支持

Checking for the existence of a capability (exists) and checking for a specific string in a capability (equals) are the only two supported operations for demands.

所以 existsequals 是仅有的两种可能性,没有 in

相反,您可以为您需要的代理定义 user-defined capability

例如: 如果您将“测试”功能添加到 agent1 到 agent10,将 agent40 添加到 AutomationAgent 池的 agent60。然后就可以使用下面的需求了

pool:
  name: AutomationAgent
  demands: Test

这与下面相同。但是就像我之前说的 in 还不可用。

pool:
  name: AutomationAgent
  demands:
    - Agent.Name -in (agent1, agent2, agent3.... agent10, agent40.... agent60)