首页 > 解决方案 > Azure 管道不并行运行矩阵作业

问题描述

尽管设置了如何在 Microsoft 托管代理池上的 Azure Pipelines 上实现作业的实际并行执行?推荐,我一直按顺序运行的天蓝色管道。我期待在两个 linux/windows 中并行运行:

trigger:
  branches:
    include:
      - 'master'

strategy:
  maxParallel: 2
  matrix:
    windows-stable:
      imageName: 'windows-latest'
      rustup_toolchain: stable
    linux-stable:
      imageName: 'ubuntu-latest'
      rustup_toolchain: stable

pool:
  vmImage: $(imageName)

steps:
  - script: |
      sudo apt-get update &&
      sudo apt-get install wget ca-certificates &&
      sudo apt install libncursesw5-dev
      wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
      sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
      sudo apt-get update &&
      sudo apt-get install libpq-dev postgresql-11 postgresql-contrib-11 postgresql-client-11
      echo "host    all             all             127.0.0.1/32            md5" > sudo tee -a /etc/postgresql/11/main/pg_hba.conf &&
      sudo service postgresql restart && sleep 3 &&
      sudo -u postgres psql -c "CREATE DATABASE \"BestSeller2\"" &&
      sudo -u postgres psql -c "ALTER USER postgres PASSWORD 'pinkycerebro';" &&
               sudo service postgresql restart && sleep 3
    displayName: Install PG
    condition: ne( variables['Agent.OS'], 'Windows_NT' )
  - script: |
      choco install llvm
      refreshenv
    displayName: Install CLANG
    condition: eq( variables['Agent.OS'], 'Windows_NT' )

  - script: cargo test --all
    displayName: Cargo test

标签: azureparallel-processingrustazure-devops

解决方案


Azure DevOps 对可以同时启动的并行作业的数量有限制。这取决于您的情况:

  1. Microsoft 托管 CI/CD。在发布这篇文章时,私人项目有 1 个免费工作(运行时间限制为 60 分钟),公共项目最多有 10 个。
  2. 自托管 CI/CD。在给出此答案时,每个 Visual Studio Enterprise 订阅者有 1 个免费工作 + 1 个免费额外工作或公共项目的无限工作。

因此,我建议您首先检查这是否可能是您的管道中未并行化的原因。如果您在一个没有任何 VS 企业订阅的私人项目中,您应该考虑转移到公共项目或保留至少两个代理池(一个自托管 CI/CD 另一个用于 Microsoft 托管 CI/CD)如果您想获得某种程度的并行化。

查看https://docs.microsoft.com/en-us/azure/devops/pipelines/licensing/concurrent-jobs?view=azure-devops以查看最新文档。


推荐阅读