【问题标题】:What is the difference between Pipelines - Create and Definitions - Create in Azure DevOps REST API?管道 - 创建和定义 - 在 Azure DevOps REST API 中创建有什么区别?
【发布时间】:2021-08-13 05:58:45
【问题描述】:

我试图使用Pipeline - Create Azure DevOps REST API 创建一个 yml 管道,即使我在 yml 文件中提到了池,它也会抛出异常“未指定池”。有关此问题的更多详细信息,请访问 here。 请在下面找到用于创建管道的请求正文。

{
"folder": "",
"name": "pipeline-by-api",
"configuration": {
    "type": "yaml",
    "path": "/azure-pipelines.yml",
    "repository": {
        "id": "00000000-0000-0000-0000-000000000000",
        "name": "repo-by-api",
        "type": "azureReposGit"
    }
}

然后我确定了第二个 REST API,Definitions - Create,并使用它成功地创建了一个管道。请在下方找到用于创建构建定义的请求正文。

    {     
     "process":{
       "yamlFilename":  "azure-pipelines.yml"
     },
     "queue":{
       "pool":{
         "name": "Azure Pipelines"
        }
     },
     "repository": {
       "id":  "00000000-0000-0000-0000-000000000000",
       "type":  "TfsGit",
       "name":  "repo-by-api",                       
       "defaultBranch":  "refs/heads/master"
     },  
     "name":  "pipeline-by-api",  
     "path":  "\\API-Test",
     "type":  "build",
     "queueStatus":  "enabled"
    }

我想了解两者之间的区别。我试过Definitions - Create 因为Pipelines - Create 不适合我。但这是创建管道的正确方法吗?

【问题讨论】:

    标签: azure azure-devops azure-pipelines azure-devops-rest-api


    【解决方案1】:

    Definitions - Create 是较旧的端点。在 YAML 管道成为一等公民之前,它就已经可用。 Pipelines - Create 是一个适用于 YAML 管道的新端点。两者都可用于创建管道,如果您将 API 版本更改为 4.1,您将看到 Pipelines 不可用。

    如果我不得不猜测,他们会找到一个理由来创建一个新的端点来处理 yaml 管道,可能是为了避免一些重大更改,但这只是一个猜测。

    【讨论】:

    • 管道 - 创建仅从 6.0 开始可用,我也有同样的猜测以避免破坏性更改 - 您可以注意到带有管道的 preview 标志 - 创建但不是定义 - 创建
    猜你喜欢
    • 2021-04-29
    • 2020-03-07
    • 2019-08-24
    • 1970-01-01
    • 2020-05-09
    • 2020-10-04
    • 2023-03-14
    • 2019-10-07
    • 1970-01-01
    相关资源
    最近更新 更多