在 Azure DevOps YAML 管道上分配特定代理

Dàn*_*dez 6 azure azure-devops azure-pipelines azure-pipelines-release-task azure-pipelines-yaml

我正在尝试在我的代理池中分配一个特定的代理,但我不知道该怎么做。有人知道吗?

我试过这个但不起作用:

- stage: Deploy
  pool: alm-aws-pool
    agent.name: deploy-05-agent1
Run Code Online (Sandbox Code Playgroud)

Kev*_*SFT 9

池名称需要添加到name字段中,然后您可以添加demands. 您可以尝试以下 Yaml 代码:

stages:
- stage: Deploy
  pool: 
   name: AgentPoolName(e.g. alm-aws-pool)
   demands:
    - agent.name -equals Agentname (e.g. deploy-05-agent1)
  jobs:
  - job: BuildJob
    steps:
    - script: echo Building!
Run Code Online (Sandbox Code Playgroud)

请检查它是否可以工作。

希望这可以帮助。

  • 不要犯和我一样的错误,将代理名称用引号引起来。它会失败:(所以不要写`-agent.name -equals 'Agentname'` (4认同)