Search code examples
azure-devopstriggersyamlazure-pipelinesazure-pipelines-yaml

Trigger Multiple pipelines using another pipeline (same Project) - Azure DevOps


How to create a pipeline (YAML configuration, not classic) that is able to trigger multiple pipelines, in the same Project, inside Azure DevOps Organization ?

Trigger all the pipelines in the list, at the same time, no matter the result of the build(s) of each one of them, fail or pass.

Thank You.


Solution

  • To trigger one pipeline after another, configure a pipeline resource trigger.

    For example, if pipeline A should trigger pipelines B, C and D (in the same project) you can define the following trigger (or similar) in each one of them:

    # Resource to define in pipelines B, C and D
    
    resources:
      pipelines:
      - pipeline: source # pipeline alias
        source: A # source (aka triggering) pipeline name
        trigger: true # trigger a run when any run of A pipeline completes
    

    You can optionally specify branch filters, stage filters and tag filters:

    # Resource to define in pipelines B, C and D
    
    resources:
      pipelines:
      - pipeline: source # pipeline alias
        source: A # source (aka triggering) pipeline name
        trigger:
          branches: # Branches to include and/or exclude
            include:
            - main
            - develop
            - features/*
            exclude:
            - features/experimental/*
          tags: # List of tags that when matched will trigger the pipeline. 
          - release25
          stages: # List of stages that when complete will trigger the pipeline. 
          - build
    

    Please refer to the documentation for more details.