We are triggering a lot of builds in Azure DevOps these days. If anyone so much as looks at an AL file we start a new build.
OK, that’s a small exaggeration, but we do use our build pipelines for:
- Continuous integration i.e. whenever code is pushed up to Azure DevOps we start a build
- Verifying our apps compile and run against different localisations (more of that another time)
- Checking that a dependent app hasn’t been broken by some changes (what we’re going to talk about now)
- Building our app against different upcoming versions of Business Central (this is an idea that we haven’t implemented yet)
Background Reading
If you haven’t got a clue what I’m talking about you might find a little background reading useful. These might get you started:
- Freddy’s blog series on extension development – specifically part 3
- Session at NAVTechDays on CI/CD this year
- My intro to CI/CD concepts
Overview
We’re considering a similar problem to the one I wrote about in the last post on package management – but from the other end. The question then was, “how do I fetch packages (apps) that my app depends on?” Although not explicitly stated, a benefit of the package management approach is that you’ll find out pretty quickly if there are any breaking changes in the dependency that you must handle in your app.
Obviously, you want to minimise the number of times you make a breaking change in the first place but if you can’t avoid it then change the major version no. and do your best to let any dependent devs know how it will affect them e.g. if you’re going to change how an API works, give people some notice…I’m looking at you Microsoft 😉
But what if we’re developing the dependency and not the dependent app? There will be no trigger to build the dependent app and check that it still works.
Chaining Builds
Azure DevOps allows you to trigger a new build on completion of another build. In our scenario we’ve got two apps that are built from two separate Git repositories in the same Azure DevOps project. One is dependent upon the other.
It doesn’t really matter for the purposes of this post what the apps do or why they are split into two but, for the curious, the dependent app provides a little slice of extra functionality for on-prem customers that cannot be supported for SaaS. Consequently the dependency (which has the core functionality supported both for SaaS and on-prem) is developed far more frequently than the dependent app.
We want to check that when we push changes to the dependency that the dependent app still works i.e. it compiles, publishes, installs and the tests still run.
You can add a “Build Completion” trigger to pipeline for the dependent app. This defines that when the dependency app is built (filtered by branch) that a build for the dependency kicks off.
That way if we’ve inadvertently made some breaking change we gives ourselves a chance to catch it before our customers do.
Limitations
Currently the triggering and to-be-triggered build pipelines must be in the same Azure DevOps project – which is a shame. I’d love to be able to trigger builds across different projects in the same organisation. No doubt this would be possible to achieve through the API – maybe I’ll attempt it some day – but I’d rather this was supported in the UI.
One thought on “Chaining Builds in Azure DevOps”