我们的团队正在使用YAML模式创建一个Azure DevOps管道来运行我们的测试脚本,运行相同测试脚本的多个迭代。如何告诉作业运行相同的测试8次,但限制并行运行的最大测试数3?
Azure DevOps YAML模式引用展示了一种限制运行矩阵并行运行次数的方法:
job: Build
strategy:
maxParallel: 2
matrix:
Python35:
PYTHON_VERSION: '3.5'
Python36:
PYTHON_VERSION: '3.6'但试着像
job: Build
strategy:
maxParallel: 2
parallel: 8抛出一个错误,表示并行是一个意外的标识符。
发布于 2020-08-03 10:10:36
这是有点晚,但仍然希望为其他人提供一个答案。如果您查看以下文档:https://learn.microsoft.com/en-us/azure/devops/pipelines/process/phases?view=azure-devops&tabs=yaml#define-a-single-job
它谈到了YAML工作的完整规范:
- job: string # name of the job, A-Z, a-z, 0-9, and underscore
displayName: string # friendly name to display in the UI
dependsOn: string | [ string ]
condition: string
strategy:
parallel: # parallel strategy
matrix: # matrix strategy
maxParallel: number # maximum number simultaneous matrix legs to run
# note: `parallel` and `matrix` are mutually exclusive
# you may specify one or the other; including both is an error
# `maxParallel` is only valid with `matrix`
continueOnError: boolean # 'true' if future jobs should run even if this job fails; defaults to 'false'
pool: pool # agent pool
workspace:
clean: outputs | resources | all # what to clean up before the job runs
container: containerReference # container to run this job inside
timeoutInMinutes: number # how long to run the job before automatically cancelling
cancelTimeoutInMinutes: number # how much time to give 'run always even if cancelled tasks' before killing them
variables: { string: string } | [ variable | variableReference ]
steps: [ script | bash | pwsh | powershell | checkout | task | templateReference ]
services: { string: string | container } # container resources to run as a service container它声明了'parallel' and 'matrix' are mutually exclusive。这意味着您只能在矩阵策略中使用maxParallel。没有矩阵,你必须使用“并行”。
发布于 2019-03-06 18:01:30
我觉得应该是这样的:
jobs:
- job: xxx
strategy:
parallel: 8 # parallel strategy, see below
maxParallel: 3 # maximum number of agents to simultaneously run copies of this job onhttps://stackoverflow.com/questions/55029457
复制相似问题