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

问题描述 投票:2回答:1

我有一个非常简单但很慢(~15分钟)的节点测试,我想在Ubuntu和Linux上运行,并且对于节点6,8和10上的每一个 - 总共6个“作业” - 通过Azure DevOps上的Azure管道。

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

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添加到我的存储库,似乎有时似乎只有一些并行性正在进行。我经常等几分钟才能开始工作。这可能是Azure Pipelines方面的容量问题,没有运行测试的代理可用吗?

当某些东西开始时,每个操作系统大多只有一个作业,而来自matrix的其他作业是“未启动/排队”。 matrix工作不应该并行执行吗?


这让我想到了我真正的问题: 有没有办法在Microsoft托管代理池上的Azure管道上实现作业的实际并行执行?

azure-devops azure-pipelines
1个回答
3
投票

更改

  strategy:
    matrix:
      node_6_x:
        node_version: 6.x
      node_8_x:
        node_version: 8.x
      node_10_x:
        node_version: 10.x

  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目前仅被记录为"restricts the amount of parallelism.",但似乎需要获得matrix配置的并行性。

Job in the YAML schema的文档没有帮助,因为它显示maxParallel作为matrixparallel的替代品。)

© www.soinside.com 2019 - 2024. All rights reserved.