Azure pipeline - trigger on feature branch

4.6k Views Asked by At

My azure-pipeline.yml is defined like this:

trigger:
  branches:
    include:
    - master
    - develop

steps:
-task1
-task2
-task3

On each push to develop branch the pipeline is triggered - as expected. I want to trigger the same pipeline on the feature branch.

I created the new branch from develop branch. The name is featureBranch. I edited azure-pipeline.yml to look like this:

trigger:
  branches:
    include:
     - master
     - develop
     - featureBranch

steps:
-task1
-task2
-task3

When I push the code to featureBranch the pipeline will not trigger. I have tried also this but without success:

trigger:
  branches:
    include:
    - '*' 
2

There are 2 best solutions below

1
On

Agree with vollmer.io. You could edit this yaml pipeline and check its Triggers settings. enter image description here

If there are UI trigger settings which override your yaml trigger settings. enter image description here

In addition, if you want to trigger this pipeline when there are pushes to all branches, the following syntax should work.

trigger:
  branches:
    include: 
    - /*

See: CI triggers for more details.

0
On

A common error scenario is that there are UI Settings which override your YAML-Settings. You can check that in ADO-UI under Pipelines -> the "three dots" -> Triggers. Also try to include filepaths to further test your scenario:

> trigger: 
>   paths:
>    include: *