使用YAML的Azure管道到管道触发器(跳过)

时间:2020-07-01 14:20:26

标签: yaml azure-pipelines

我在第一个管道中有一个称为validate的变量,如果将其设置为true,则跳过第二个管道的触发器。

yaml示例管道

trigger: none // add this trigger value to none 
resources:
  pipelines:
  - pipeline: RELEASE_PIPELINE // any arbitrary name
    source: PIPELINE_NAME.    // name of the pipeline shown on azure UI portal
    trigger:
    branches:
      include:
        - dummy_branch 

我在管道上设置了一个变量(作为全局变量),该变量称为 validate (是/否)。

如果第二个管道设置为True,则不应触发。

1 个答案:

答案 0 :(得分:0)

使用触发管道中的变量无法满足您的要求。代替使用触发管道,您可以使用任务使第二个管道排队并确定任务是否将运行。例如:

parameters:
- name: 'validateTrigger'
  type: boolean
  default: false

steps:
- task: #first pipeline tasks
- ${{ if eq(parameters.validateTrigger, true) }}:
  - script: #queue second pipeline