resources.pipelines.pipeline.trigger 定义

指定 none 可禁用、true 以包括所有分支,或使用完整语法,如以下示例中所述。

引用此定义的定义:resources.pipelines.pipeline

实现

执行 说明
触发器:已启用、分支、阶段、标记 使用完整语法配置管道资源触发器。
触发器:无 |true 指定 none 可禁用或 true 以包括所有分支。
执行 说明
触发器:已启用,分支 指定 none 可禁用、true 以包括所有分支,或使用完整语法,如以下示例中所述。
触发器:无 |true 指定 none 可禁用或 true 以包括所有分支。

注解

可通过多种方式在管道资源中定义触发器。 若要在引用的管道的任何运行完成时触发运行,请使用 trigger: true

resources:
  pipelines:
  - pipeline: source-pipeline
    source: TriggeringPipeline
    trigger: true

若要禁用管道资源触发器,请指定 none值。

resources:
  pipelines:
  - pipeline: source-pipeline
    source: TriggeringPipeline
    trigger: none

若要配置分支筛选器,请使用完整的语法。 可以将分支筛选器指定为要包含的分支列表,也可以指定为要包含的分支列表,以及要排除的分支列表。

若要指定要包含和排除的分支列表,请使用以下 trigger 语法。

resources:
  pipelines:
  - pipeline: source-pipeline
    source: TriggeringPipeline
    trigger:
      branches:
        include:
        - main
        - develop
        - features/*
        exclude:
        - features/experimental/*

若要指定要包含的分支列表(不含排除),请省略 exclude 值,或使用以下语法指定要直接在 branches后包括的分支列表。

resources:
  pipelines:
  - pipeline: source-pipeline
    source: TriggeringPipeline
    trigger:
      branches:
      - main
      - develop

若要按阶段或标记进行筛选,请使用以下 trigger 语法。

resources:
  pipelines:
  - pipeline: source-pipeline
    source: TriggeringPipeline
    trigger:
      branches: # Branches to include
      tags: # List of tags that when matched will trigger the pipeline. 
      - release25
      stages: # List of stages that when complete will trigger the pipeline. 
      - build

有关详细信息,请参阅 管道完成触发器

重要

定义资源触发器时,如果其管道资源来自与当前管道相同的存储库,则触发时会遵循引发事件的同一分支并提交。 但是,如果管道资源来自不同的存储库,则当前管道在 默认分支指定的分支上触发,用于手动生成和计划生成 设置。 有关详细信息,请参阅 分支注意事项,了解管道完成触发器

触发器:已启用、分支、阶段、标记

使用完整语法配置管道资源触发器。

trigger:
  enabled: boolean # Whether the trigger is enabled; defaults to true.
  branches: branches # Branches to include or exclude for triggering a run.
  stages: [ string ] # List of stages that when matched will trigger the pipeline.
  tags: [ string ] # List of tags that when matched will trigger the pipeline.

性能

enabled 布尔
是否启用触发器;默认值为 true。

branches resources.pipelines.pipeline.trigger.branches
要包含或排除的分支名称以触发运行。

stages 字符串列表。
匹配时触发管道的阶段列表。

tags 字符串列表。
匹配时触发管道的标记列表。

触发器:已启用,分支

指定 none 可禁用、true 以包括所有分支,或使用完整语法,如以下示例中所述。

trigger:
  enabled: boolean # Whether the trigger is enabled; defaults to true.
  branches: branches # Branches to include or exclude for triggering a run.

性能

enabled 布尔
是否启用触发器;默认值为 true。

branches resources.pipelines.pipeline.trigger.branches
要包含或排除的分支名称以触发运行。

触发器:无 |真

指定 none 可禁用或 true 以包括所有分支。

trigger: none | true # Specify none to disable or true to include all branches.

trigger 字符串。 允许的值:无 |真。

指定 none 可禁用或 true 以包括所有分支。