'Separate yaml pipeline triggers with include are triggering all pipeline builds
I am new to Azure Devops and need some help on figuring out pipeline triggers defined in .yaml files with include syntax.
What I am trying to do is to have a pipeline for each branch, that gets triggered only when something changes on that branch controlled by yaml include syntax. Eventually resulting artifacts from different branches would be deployed to different environments. (Note: I have successfully tested this out without the yaml include syntax by overriding the yaml trigger from the UI and specifying the explicit branch)
Under Azure repositories I have two branches and two pipelines.
pipelineMain for corresponding main branch with pipelineMain.yaml file having include syntax (.yaml file part of main branch)
trigger: branches: include: - mainpipelineReleaseV1 for corresponding release/v1 branch with pipelineReleaseV1.yaml file having include syntax (.yaml file part of release/v1 branch)
trigger: branches: include: - release/v1
Whenever something is pushed into any of the branches, both pipelines get triggered using the .yaml file from the branch that the changes were pushed into. It is like manually running both pipelines using the same branch.
Examples: A. If something is pushed into release/v1 branch the following happens:
- pipelineMain is triggered
- checking the build jobs: getting sources from release/v1, executing jobs defined in pipelineReleaseV1.yaml file specific to release/v1 branch
- pipelineReleaseV1 is triggered
- checking the buid jobs: getting sources from release/v1, executing jobs defined in pipelineReleaseV1.yaml file specific to release/v1 branch
B. If something is pushed into main branch the following happens:
- pipelineMain is triggered
- getting sources from main, executing jobs defined in pipelineMain.yaml file specific to main branch
- pipelineReleaseV1 is triggered
- getting sources from release/v1, executing jobs defined in pipelineMain.yaml file specific to main branch
Is this the default behaviour?
I have tried different .yaml syntax versions with same result, how can I specify in the .yaml file to trigger only one pipeline to build on the branch that contains the .yaml having the desired include?
Am I having the wrong approach here because pipelines are not designed to be coupled to branches (however at the end I would like to have different builds for different branches)?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
