I create simple Azure DevOps Pipelines which should start for those specific branches:
trigger:
branches:
include:
- main
- develop
- release
pool:
name: $(agent)
# Rest of the code
I pushed that pipeline from develop branch and it starts executing. When I switched to the hotfix/test
branch, and pushed the commit again, no pipeline was triggered. So I add above pipeline to hotfix/test
again, now it works. The same with release I did, so now I have the same pipeline in three different branches. At the end I want to push my changes to main branch, and my assumption was that it will be working for all above branches and commits respectively.
In Pipeline settings I have set develop as default branch:
I am not sure if it is a default Azure DevOps Pipelines behavior or mine misunderstanding. However I want to have that pipeline in main
branch and see that it works for commits pushed from those branches.
As mentioned in the comments, YAML pipeline file (and correspondent templates) must exist in the branches specified in the trigger.
I suggest you do the following when adding a new YAML pipeline:
trigger
configuration for the other branches such as dev
, releases/*
, hotfix/*
, etcmain
or master
)dev
) cherry-pick changes from the pull request containing the pipeline