如何在Microsoft托管代理池上的Azure Pipelines上实现作业的实际并行执行?

How to achieve actual parallel execution of jobs on Azure Pipelines on pool of Microsoft-hosted agents?

我有一个非常简单但很慢(?15分钟)的节点测试,我想在Ubuntu和Linux上运行,并且分别在节点6、8和10上运行-通过Azure管道总共6个"工作"在Azure DevOps上。

我的azure-pipeline.yml看起来像这样:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
jobs:
- job: Ubuntu
  pool:
    vmImage: 'Ubuntu 16.04'
  strategy:
    matrix:
      node_6_x:
        node_version: 6.x
      node_8_x:
        node_version: 8.x
      node_10_x:
        node_version: 10.x
  steps:
  - task: NodeTool@0
    inputs:
      version: $(node_version)
    displayName: 'Install Node.js $(node_version)'  
  - script: |
      npm install
    displayName: 'npm install'
  - script: |
      npm run test
    displayName: 'npm test'
- job: Windows
  pool:
    vmImage: 'vs2017-win2016'
  strategy:
    matrix:
      node_6_x:
        node_version: 6.x
      node_8_x:
        node_version: 8.x
      node_10_x:
        node_version: 10.x
  steps:
  - task: NodeTool@0
    inputs:
      version: $(node_version)
    displayName: 'Install Node.js $(node_version)'  
  - script: |
      npm install
    displayName: 'npm install'
  - script: |
      npm test
    displayName: 'npm test'

因为这是GitHub上的开源存储库,所以我希望这6次测试运行可以并行进行(因为应该有10个并行作业)。

观察将azure-pipeline.yml添加到我的存储库中的pull请求的管道运行,似乎似乎只是有时候似乎正在进行一些并行处理。我经常等待几分钟才能开始任何工作。这可能是Azure管道方面的容量问题,没有可用的代理来运行测试吗?

启动某件事时,每个操作系统通常只有一项工作,而matrix中的其他任务是"未启动/已排队"。 matrix作业不应该并行执行吗?

这带给我我真正的问题:
有没有一种方法可以在Microsoft托管代理的池上的Azure Pipelines上实现作业的实际并行执行?


更改

1
2
3
4
5
6
7
8
  strategy:
    matrix:
      node_6_x:
        node_version: 6.x
      node_8_x:
        node_version: 8.x
      node_10_x:
        node_version: 10.x

1
2
3
4
5
6
7
8
9
  strategy:
    maxParallel: 3
    matrix:
      node_6_x:
        node_version: 6.x
      node_8_x:
        node_version: 8.x
      node_10_x:
        node_version: 10.x

(请注意附加的maxParallel: 3)似乎已经完成了该工作:现在,一旦对PR分支进行了提交,构建就一起开始了。

虽然maxParallel当前仅被记录为"限制并行性的数量。",但似乎完全需要为matrix配置获得并行性。

(YAML模式中的Job文档没有帮助,因为它显示maxParallel作为matrixparallel的替代。)