azureazure-devopsazure-pipelinesazure-pipelines-yaml

How to prevent build for new branch creation in azure devops yaml


In Azure DevOps, created pipeline using Yaml file and mentioned "develop" under Triggers section. It is triggering for new commits in develop branch but also triggering for new branch creation based on "develop" branch which is not happening when I create a static pipeline. How can I prevent build for new branch. Any help here?


Solution

  • I think you should use the include / exclude filters like below :

    # this is being defined in app-ci pipeline
    resources:
      pipelines:
      - pipeline: securitylib
        source: security-lib-ci
        trigger: 
          branches:
            include: 
            - releases/*
            exclude:
            - releases/old*
    

    Just check this page and you should find your answer : https://learn.microsoft.com/en-us/azure/devops/pipelines/process/pipeline-triggers?view=azure-devops

    Regards