Azure Devops 构建之间的区别 - 队列与 运行 管道 REST API

Difference between Azure Devops Builds - Queue vs run pipeline REST APIs

我确实看到 运行 Azure devops 管道

的两个选项
  1. 运行管道->https://docs.microsoft.com/en-us/rest/api/azure/devops/pipelines/runs/run%20pipeline?view=azure-devops-rest-6.0
  2. 建立队列->https://docs.microsoft.com/en-us/rest/api/azure/devops/build/builds/queue?view=azure-devops-rest-6.1

我想了解这两个 API 的区别以及何时使用什么?

I would like to understand differences of both APIs.

Azure Devops 提供 Classic UI builds and Yaml build pipelines。这两个API都可以启动一个管道运行(无论是Classic UI Build pipeline还是Yaml Build pipeline)。两个API的最大区别在于Request Body:

1.You应该知道Yaml管道引入了一个重要的功能Runtime parameters。我们在使用Run pipeline API时可以传递变量和参数,但是在使用Builds-Queue时只能传递变量 API.

api-version 6.0 之后的新 Run pipeline API 支持传递 parameters/variables,这对 Yaml 管道很重要。但是旧的Queue-build不支持参数,它只支持变量(parameters here实际上是变量,它不是YAML的真正参数)。

2.What 更多,我们可以对 CI 和 CD 使用普通的 yaml 管道。是 multi-stage Yaml pipeline。对于运行这样的pipeline,强烈推荐使用Run pipeline.

仔细检查Run pipeline的Request Body,你会发现Run pipeline与Yaml pipeline的关系比较大。 StagesToSkip 元素和 yamlOverride 是 YAML 管道的独特功能。

When to use what?

为经典 UI 构建管道选择 Run pipeline for YAML pipeline and chose Builds-Queue不需要(这两个API都可以启动Classic Build 运行和Yaml Build 运行)但是更推荐.