如何为 Azure 中的每个分支设置不同的管道

Arc*_*ano 6 azure-devops azure-pipelines

我有一个项目,但有两个“主”分支。

  • 掌握
  • 虚拟/主控

他们每个人都有自己的azure-pipeline.yml分支机构的具体情况。

第一个管道的master触发器设置为

trigger:
  batch: true
  branches:
    include:
      - refs/heads/master
Run Code Online (Sandbox Code Playgroud)

第二个是在virt/master分行里。

trigger:
  batch: true
  branches:
    include:
      - refs/heads/virt/master
Run Code Online (Sandbox Code Playgroud)

这是我正在试验的存储库https://dev.azure.com/trajano/experiments/_git/multi-branch

我遇到的问题是,当我将更改推送到virt/master分支时,两个管道都会被执行

在此输入图像描述

我的配置中是否缺少某些内容?或者这是 Azure Devops 上的一个错误?

我也尝试过排除,但无济于事。

trigger:
  batch: true
  branches:
    include:
      - refs/heads/master
    exclude:
      - refs/heads/virt/master
Run Code Online (Sandbox Code Playgroud)

Lev*_*SFT 4

为不同的分支创建不同的管道。您需要在virt/master分支中重命名 azure-pipelines.yml 文件,或者使用一些内容和不同的名称创建一个新的 yml 文件。并从这个新的 yml 文件创建管道multi-branch(virt)

如果两个管道都是从具有相同名称 azure-pipeline.yml 的 yaml 文件创建的。并且 azure-pipeline.yml 文件存在于两个分支中。那么它们就是相同的管道( even though the azure-pipeline.yml file contents might be different)。

您可以从上面的屏幕看到。管道multi-branchmulti-branch(virt)正在建设相同的virt/master分支(using the tasks in the azure-pipeline.yml of virt/master)。如果你推送到master分支。您将看到两个管道都将被触发来构建主分支(using the tasks in the azure-pipeline.yml of master)。管道multi-branchmulti-branch(virt)是一根管道

请参阅本主题以获取更多信息。