我已经为一个代码库设置了CI构建触发器,如下所示:
trigger:
- master
我有一个相同代码库的分支,我希望它拥有自己的流水线。
在分支的 pipeline.yml 文件中,我有以下内容:
trigger:
- ops-workshop/ms-lab01
然而,如果我提交分支上的更改,则会触发主管道和分支管道的构建。
将更改提交到主管道还会触发分支管道的构建(这不应该发生)。
我尝试使用branches
节点来排除主管道,但似乎没有任何效果。参见:
trigger:
branches:
include:
- ops-workshop/ms-lab01
exclude:
- master
唯一似乎能够阻止针对主管道进行构建的是使用通配符运算符来排除所有内容 - 然后不会触发任何构建。
如果我在 Azure DevOps 门户中进行更改,是否会有所不同。
这似乎是一个非常琐碎的问题,但是即使设置了排除项,我也不明白为什么同一提交会触发两个管道。
我的完整 YAML 文件如下:
# ASP.NET Core
# Build and test ASP.NET Core projects targeting .NET Core.
# Add steps that run tests, create a NuGet package, deploy, and more:
# https://learn.microsoft.com/azure/devops/pipelines/languages/dotnet-core
trigger:
- ops-workshop/ms-lab01
pool:
vmImage: 'ubuntu-latest'
variables:
buildConfiguration: 'Release'
steps:
- script: dotnet build --configuration $(buildConfiguration)
displayName: 'dotnet build $(buildConfiguration)'
任何建议都会受到赞赏。