Azure DevOps — Pull request validation for a multi .net solution in a large git repo
Microsoft provides a lot of features to make your application cloud ready. which in turn make it easy to adopt a DevOps culture in software development.
You can go through the below link to understand the service provided by Azure DevOps by Microsoft. Visual studio team services(VSTS) is now renamed as Azure DevOps. https://visualstudio.microsoft.com/team-services/
Pull request(PR) and code review is one of the main concepts of the development process, Which will help you to build a quality code.
Azure DevOps tool will give a couple of option to set up this process easily. While working with a large code base with multiple application in a single git repository, I come across a situation where I want to build only the application which I made changes to.
Consider an example, I have a repo with multiple application within it and each application is maintained by the corresponding team of developers.
The above picture shows 2 apps(MyContact and MyLogin independent apps) in the same repo. when I develop a new feature for MyLogin app my code changes will contain a code corresponding to MyLogin. So it is not necessary to build MyContact app for MyLogin changes.
Below steps will show how we can achieve the goal.
Step 1: Set up build in Azure
Click save and queue. After the end of step 1, you will have a build which runs on your solution.
Step 2: Setup branch policies
Select the build created in step 1, and provide the path filter.
Path filter is the main part of build selection. This is the list of the folder path. In the above example, /MyLogin/* — Selects build whenever it find any changes in MyLogin folder. You may come across a situation where your app is depending on another app to consider this scenario I have provided a one more path /SharedProjects/* with ; separated. So now any changes to SharedProjects it will run MyLogin build as well. That ensures no impact on the consuming app.
Similarly, I have created a build for the MyContact app and build for the shared project.
MyContact build — Will run on any changes to my contact code also on any shared project code.
MyLogin build — Will run on any changes to my login code also on any shared project code.
SharedProject build- Will run on any changes to shared code
Step 3: Create a pull request and validate the setup
The above picture shows the PR raised for my logic which contains changes only to mylogin code. So triggers corresponfing build i.e MyLogin build.
In the above picture, I have changed the shared code and raised the PR. You can see 3 builds got triggered to validate changes. This ensures all dependent projects build successfully before code merges to master.
Git repo URL used for this article: https://thejas007.visualstudio.com/MultiSolutionBuild/_git/MultiSolutionBuild