Azure DevOps has a feature where you can trigger a build pipeline once a change is done to another repo other than the main code repo. That would help us to achieve the above-mentioned challenge. This post discusses how to trigger a build pipeline due to the code push done to the multiple repos.
Following is the Sample code of YAML build pipeline in DemoWebbApp project.
trigger:
- master
resources:
repositories:
- repository: RepoX
type: git
name: DemoWebbApp/RepoX
ref: master
trigger:
branches:
include:
- masterLet’s try to understand each important part of the YAML file as follows.
trigger:
- master
- Once any change is push to master branch of the RepoA, build triggers.
repositories:
- repository: RepoX
type: git
name: DemoWebbApp/RepoX
ref: master
trigger:
branches:
include:
- master- This part explains how to set build triggers for another Repo. According to the above YAML code segment, once a change is done to the master branch of the RepoX, build pipeline will get triggered.
Likewise, we can set multiple triggers from multiple repos. Once any change done to the master branch of RepoX or RepoA build get triggered. To get more idea of the build pipeline, go to triggered build pipeline and you would be able to see multiple sources as mention in following image.
To see more details of the changes in the build in the pipeline, click on "view changes" button on the build summary page. It will open the page which display all the changes built in the selected build.


No comments:
Post a Comment