0

Suppose I have two libraries A and B, where B has a dependency on A. Both A and B are set up for Continuous Integration with their own respective pipelines. A change in A will cause the "A" pipeline to run and deploy a new version, and likewise for B.

Now suppose I write a Pull Request that contains changes to both A and B, where the changes in B depend on the new changes in A. Therefore, A must build before B, otherwise the build for B will fail.

My problem is that, to my knowledge, the CI platform we're using (Azure DevOps) doesn't have any sort of mechanism for specifying build order. You can have one pipeline trigger another (e.g. running A could trigger a run of B), but that doesn't prevent B from possibly running first if there are changes to both A and B (Azure docs: Combining trigger types), resulting in frequent wasted runs that are destined to fail.

The easy answer is probably to have one pipeline for both libraries, and build both of them any time either of them changes. However, that's not ideal, and it's even more of a problem because we actually have more than 2 libraries. Our app has dozens, and we don't want to build and deploy dozens of libraries, with new version numbers, every time just one of them changes.

So my question is two parts:

A) Is there something fundamentally wrong with our approach from a "correct" CI practice standpoint? I would think this would be a common enough scenario that Azure DevOps would be equipped to handle it, so the fact that it doesn't makes me think there's something fundamentally wrong with our approach that we need to adjust.

B) If this is a valid approach to CI, why isn't Azure DevOps equipped to handle it, or is there some good way to accomplish this in Azure that I'm overlooking?

Sigenes
  • 445
  • 2
  • 13

1 Answers1

0

You can call different templates from a pipeline YAML depending on a condition. For your reference: Parameters to select a template at runtime

parameters:
- name: optionTemplate
  displayName: optional run pipeline'
  type: string
  default: runFirst

- ${{ if eq(parameters.experimentalTemplate, runFirst) }}:
  - template: First.yml
  - template: Second.yml
- ${{ if not(eq(parameters.experimentalTemplate, runSecond)) }}:
  - template: Second.yml
Minxin Yu - MSFT
  • 2,234
  • 1
  • 3
  • 14