如何为Azure中的每个分支设置不同的管道 [英] How do I set up different pipelines for each branch in Azure

查看:81
本文介绍了如何为Azure中的每个分支设置不同的管道的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个项目,但有两个主"项目,分支.

  • 主人
  • virt/master

每个人都有专门针对其分支机构的 azure-pipeline.yml .

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

 触发:批次:真分支机构:包括:-裁判/负责人/大师 

第二个位于 virt/master 分支中.

 触发:批次:真分支机构:包括:-裁判/负责人/virt/master 

这是我在

我在配置中缺少什么吗?还是这是Azure Devops上的错误?

我也试图排除但无济于事.

 触发:批次:真分支机构:包括:-裁判/负责人/大师排除:-裁判/负责人/virt/master 

解决方案

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

如果两个管道都是从yaml文件中创建的,且名称相同,则为azure-pipeline.yml.两个分支中都存在azure-pipeline.yml文件.然后它们是相同的管道(即使azure-pipeline.yml文件的内容可能不同).

您可以从屏幕上方看到.管道 multi-branch multi-branch(virt)正在使用Azure中的任务构建相同的 virt/master 分支(-pipeline.yml为virt/master ).如果您推送到主分支.您将看到两个管道都将触发以构建主分支(使用master的azure-pipeline.yml中的任务).管道 multi-branch multi-branch(virt)是一条管道

有关更多信息,请参见此线程.

I have a single project but with two "master" branches.

  • master
  • virt/master

Each of them would have their own azure-pipeline.yml specific for their branch.

The first pipeline in master has the trigger set up as

trigger:
  batch: true
  branches:
    include:
      - refs/heads/master

The second one is in the virt/master branch.

trigger:
  batch: true
  branches:
    include:
      - refs/heads/virt/master

Here's the repository that I am experimenting on https://dev.azure.com/trajano/experiments/_git/multi-branch

The problem I am having is when I push a change to the virt/master branch both pipelines get executed

Am I missing something in my configuration? Or is this a bug on Azure Devops?

I also tried to exclude but to no avail.

trigger:
  batch: true
  branches:
    include:
      - refs/heads/master
    exclude:
      - refs/heads/virt/master

解决方案

To create different pipelines for different branches. You need to rename the azure-pipelines.yml file in virt/master branch or create a new yml file with the some contents and with a different name. And create pipeline multi-branch(virt) from this new yml file.

If both pipelines are created from the yaml file with the same name azure-pipeline.yml. And the azure-pipeline.yml file exists in both of the branches. Then they are identical pipelines(even though the azure-pipeline.yml file contents might be different).

You can see from above screen. Pipeline multi-branch and multi-branch(virt) were building the same virt/master branch(using the tasks in the azure-pipeline.yml of virt/master). If you push to master branch. You will see both pipelines will be triggered to build master branch(using the tasks in the azure-pipeline.yml of master). Pipeline multi-branch and multi-branch(virt) are one pipeline

See this thread for more information.

这篇关于如何为Azure中的每个分支设置不同的管道的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆