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

disabling pipeline trigger when branch gets created


I am having multiple repo triggers in single YAML pipeline and for one repository I want to disable trigger when new branch created for test repository. I tried only including the path but didn't help.

repositories:
    - repository: BBB
      type: git
      name: ABC/tools
      ref: master
      trigger:
        branches:
          include:
            - testbranch/*
    - repository: AAA
      type: git
      name: ABC/test
      ref: master
      trigger:
        paths:
          include: 
            - origin/testbranch/*

Any suggestion to above sniffet


Solution

  • you could add "exclude" for this trigger. When new branches are created in this "testbranch" folder, the pipeline will be triggered. If you don't want the pipeline to be triggered, create the new branches with "old" prefix.

    repositories:
        - repository: BBB
          type: git
          name: ABC/tools
          ref: master
          trigger:
            branches:
              include:
                - testbranch/*
        - repository: AAA
          type: git
          name: ABC/test
          ref: master
          trigger:
            paths:
              include: 
                - origin/testbranch/*
              exclude: 
                - origin/testbranch/old***
    

    enter image description here