Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to exclude one branch in Azure DevOps build pipeline

In Azure DevOps its possible to define build pipelines which by default is executed when a code is pushed to a branch.

I want the pipeline to run for all branches except one. The configuration

trigger:
  branches:
    include:
    - branchToInclude
    exclude:
    - branchToExclude

works when I push to branchToInclude.

But if I take away the include part the pipeline is not executed when I push to branchToInclude.

trigger:
  branches:
    exclude:
    - branchToExclude

A * instead of branchToInclude is not accepted when I try to save the file. Is there a way to configure a pipeline to execute for all branches except one?

like image 269
Ulrik Avatar asked Oct 23 '25 20:10

Ulrik


1 Answers

I suppose something like this should work

trigger:
  branches:
    include:
    - '*'
    exclude:
    - branchToExclude
like image 74
4c74356b41 Avatar answered Oct 26 '25 17:10

4c74356b41