共用方式為


resources.pipelines.pipeline.trigger 定義

指定 none 來停用、true 以包含所有分支,或使用下列範例中所述的完整語法。

參考此定義的定義: resources.pipelines.pipelines.pipeline

實作

實作 描述
觸發程式:已啟用、分支、階段、標記 使用完整語法設定管線資源觸發程式。
觸發程式:無 |真 指定 none 以停用或 true 以包含所有分支。
實作 描述
觸發程式:已啟用、分支 指定 none 來停用、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。

branchesresources.pipelines.pipeline.trigger.branch
要包含或排除以觸發執行的分支名稱。

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。

branchesresources.pipelines.pipeline.trigger.branch
要包含或排除以觸發執行的分支名稱。

觸發程式:無 |真

指定 none 以停用或 true 以包含所有分支。

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

trigger 字串。 允許的值:無 |真。

指定 none 以停用或 true 以包含所有分支。