Hi,
We are trying to automatically trigger Azure DevOps pipelines based on trigger rules set in the YAML code, as per the documentation here. However, we are encountering an issue where Bitbucket creates a webhook for both Pull Request and Push triggers, and irrespective of the branch name, it is triggering the pipeline(even though we have set the branch trigger rules in 'YAML' file as specified in the documentation).
For example, we have three branches: abc
, def
, and ghi
. We've set the following triggers:
- For branch
abc
(in file_x.yml
):
pr:
branches:
include:
- abc
- For branch
def
(in file_y.yml
):
trigger:
branches:
include:
- def
- For branch
ghi
(in file_z.yml
):
trigger:
branches:
include:
- ghi
We have also created three separate pipelines, each using one of the YAML files (file_x.yml
, file_y.yml
, file_z.yml
). The issue is that whenever a 'push' happens to any branch, all three pipelines are triggering (they shouldn't because of the branch rules set in the YAML files for def
and ghi
). Similarly, when a PR is raised, all three pipelines trigger (which should not happen, as only the abc
branch pipeline should trigger).
We reached out to Bitbucket support and they replied that for every webhook request, they are sending the response of the branch name to the Azure DevOps pipelines. They asked us to handle that part on the Azure pipeline side. Despite our efforts to restrict the triggers based on the branch rules set in the YAML files, it is triggering for all branches.
We have followed the documentation exactly here(for Bitbucket repos), using the YAML code method, but it didn’t work. We also tried the 'classic' method by setting the 'include' branches in the trigger rules in the pipeline UI, but it still didn’t work. We need your help in resolving this issue. Is there any way or approach we can use to restrict the trigger based on the branch rules we set?
Thank you for your assistance.