BLuM
BLuM

Reputation: 661

Azure DevOps YAML - Problem with multiple pipelines per version/branch conception

Simplifying my current scenario is that I have repo with two branches "develop" and "release". There is azure-pipeline.yml file and two pipelines attached to it (one per branch). In develop I have:

trigger:
 branches:
   include:
     - develop

and in release is:

trigger:
 branches:
   include:
     - release

When I commit changes to only one of this branches two pipelines are triggered - why? What I missing here?

Should I exclude oposit branch (or more branches in future) or maybe have two sepearate files azure-pipeline-develop.yml and azure-pipeline-release.yml?

What is general conception to have builds per app version? When for example I would like still build old release because of patching?

What option is easier to maintain?

Upvotes: 0

Views: 2568

Answers (1)

sonofhamer
sonofhamer

Reputation: 168

If I understand you correctly, you have one azure-pipeline.yml file, and two pipelines in Azure DevOps, each using the same file.

Since both pipelines in Azure DevOps are using the same yaml file, each pipeline is evaluating the triggers across all branches on every push from every branch.

The pipeline you expect to be a "release" pipeline doesn't know that its not supposed to run "develop" builds.

As you mentioned, one of the ways to resolve this would be to create two yaml files, one per pipeline, however I think there's a better way.

Build all branches from the same pipeline.

Azure DevOps is designed to build multiple branches from the same pipeline. If you want to build a /release branch you can build it in the same pipeline that builds /develop branch. Docs and tutorials here: https://learn.microsoft.com/en-us/azure/devops/pipelines/build/ci-build-git?view=azure-devops&tabs=yaml

Upvotes: 2

Related Questions