I have two repositories and both are in same project of ADO: one is at the top level (It also include pipeline yaml), and the other is defined as a submodule. I want to trigger a pipeline whenever an update is pushed to either the main repository or any of the repositories declared as resources(submodule mentioned here).
I tried below code but it only trigger on changes in self or if i run manually.
trigger:
- main
pool:
name: 'myselfhostedagent'
resources:
repositories:
- repository: sub_repo
type: git
name: test/sub_repo
ref: master
trigger:
- master
steps:
- checkout: self
- checkout: sub_repo
- script: |
echo $(Build.Repository.Name)
echo $(Build.SourceBranch)
dir $(Build.SourcesDirectory)
Troubleshooting:
Any tips to resolve this or any way to verify from logs that as soon as i do push in sub_repo how AzureDevOps handle it.
Edit1: In response to @Alvin Zhao
if the above YAML contents are from the pipeline.yml in main branch of the TopRepo?
Yes its from TopRepo
And for the sub_repo resource, the actual project name is test and the actual repo name is sub_repo?
Project name is test and i modified repo name for asking question.
What is the default branch of sub_repo by the way.
For TopRepo default branch is main, For sub_repo its master
Please double check the Trigger settings in pipeline WEB UI if the option to Override the YAML continuous integration trigger from here was checked
It was not checked i did now, but results are same no success
Based on the description, my pipeline referencing the azure-pipelines.yml
in the main
branch of self
TopRepo was able to get trigged by the commits pushed to the main
branch of TopRepo and to the master
branch of sub_repo
in test
project.
Here is the sample for your reference to check and compare.