简体   繁体   English

Azure DevOps 代理作业自动选择池:'Hosted Ubuntu 1604'

[英]Azure DevOps Agent Job automatically select Pool: 'Hosted Ubuntu 1604'

I have created two Agent Jobs.One is for Linux and another for windows.我创建了两个代理作业。一个用于 Linux,另一个用于 Windows。 The first agent job trigged the correct build machine as mentioned in YAML file.第一个代理作业触发了 YAML 文件中提到的正确构建机器。 But the second agent job is not working as expected.但是第二个代理工作没有按预期工作。 It automatically selects the 'Hosted Ubuntu 1604'.它会自动选择“托管 Ubuntu 1604”。

YAML code YAML 代码

jobs:
 job: TestA
 timeoutInMinutes: 10
 pool: 'PoolA'

 job: TestB
 dependsOn: TestA
 condition: succeeded('TestA')
 timeoutInMinutes: 10
 pool:
 vmImages: 'windows-latest' 
 Name: 'PoolB'
 demands: 
   Agent.Name -equals 'XYZ'

There has one incorrect syntax in your YAML script: Name .您的 YAML 脚本中有一种不正确的语法: Name It should be name here.这里应该是name Also, vmImages: 'windows-latest' target to Hosted agents, if what you are picking here is self-agents pool, you should not configure vmImages here.此外, vmImages: 'windows-latest'目标为托管代理,如果您在此处选择的是自代理池,则不应在此处配置vmImages

Below is the correct format:下面是正确的格式:

jobs:
- job: TestA
  timeoutInMinutes: 10
  pool: 'pool-name'

- job: TestB
  dependsOn: TestA
  condition: succeeded('TestA')
  timeoutInMinutes: 10
  pool:
   name: 'pool-name'
   demands: 
   - Agent.Name -equals 'agent-name'

In addition, there's another thing you need know.此外,还有一件事你需要知道。

When you use demand in YAML , our system will automatically attach an another demand to it: check its Agent.Version .当您在YAML 中使用demand时,我们的系统会自动附加另一个需求:检查其Agent.Version This is the old default check we made to YAML script.这是我们对 YAML 脚本所做的旧默认检查。 You should pay attention to it since it would cause your pipeline failed sometimes.您应该注意它,因为它有时会导致您的管道失败。

This cannot be override and ignored until now.到目前为止,这不能被覆盖和忽略。 But we have a task in our backlog to try to handle this.但是我们的积压工作中有一项任务来尝试处理这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM