Azure DevOps - 如何创建不由标签触发的构建管道

Azure DevOps - How to create build pipeline NOT triggered by Tags

有没有办法创建一个在创建TAG时不触发的分支流水线触发器?我希望对 master 分支的所有提交都触发管道,但我还使用 TAG 来触发 Nuget 打包!我不想把它们混在一起...

是的。这将是在标签下的触发器上使用 exclude

resources:
  repositories:
  - repository: string  # identifier (A-Z, a-z, 0-9, and underscore)
    type: enum  # see the following "Type" topic
    name: string  # repository name (format depends on `type`)
    ref: string  # ref name to use; defaults to 'refs/heads/master'
    endpoint: string  # name of the service connection to use (for types that aren't Azure Repos)
    trigger:  # CI trigger for this repository, no CI trigger if skipped (only works for Azure Repos)
      branches:
        include: [ string ] # branch names which will trigger a build
        exclude: [ string ] # branch names which will not
      tags:
        include: [ string ] # tag names which will trigger a build
        exclude: [ string ] # tag names which will not
      paths:
        include: [ string ] # file paths which must match to trigger a build
        exclude: [ string ] # file paths which will not trigger a build

取自YAML schema documentation

Is there a way to create a branch pipeline trigger that does not trigger when a TAG is created?

答案是肯定的,我们可以使用 Push trigger with exclude 子句来触发分支和标记。

trigger: 
  branches:
    include:
    - master
  tags:
    exclude:
    - TAG

注:

  • 如果为 branchestagspaths 指定 exclude 子句而没有 include 子句,则等同于指定 *include 子句中。
  • 要排除关于 TAG 的多个标签,我们可以使用带标签的通配符,例如 TAG**