0
votes

Say you have a build and its corresponding release definition on Azure Devops.

Generally, the way it's used is like:

Repository "A" changes -> Build repo "A" -> Release to a given environment

Within this scenario (using only one build artifact), it's easy to trigger deployments (after successful build) for different branches.

But, say you also have a release definition with multiple build artifacts (from different repos), and you want to, changes coming from branch "dev" you want to deploy to environment "Development", but if changes come from branch "hotfix" you want to deploy to environment "Staging".

Something like this

You can play with branch filters on the specific environment and artifact filters on the artifact triggers.

The above scenario works very well for "dev" changes when you define your build artifacts to use "dev" as default branch.

But if you make changes on Repo A (branch hotfix), but not in Repo B, the build artifacts for that release will come from different branches, hence the "artifacts will not meet requirements", cause all changes must come from hotfix branch in order to trigger the deployment.

In my opinion, the "Default Version" of the Build Artifact itself, makes this confusion for the pipeline.

See this image example

That being said, how can we trigger a deployment into "Staging" environment if only one of the triggered changes come from the branch "hotfix" ?

The way I can see, when that happens, "Staging" environment never "meets the artifacts requirements", cause other artifacts will use version from "dev" as it's the default source branch.

Has anyone worked with a similar scenario ?

Thanks for reading my question.

1

1 Answers

0
votes

Update:

According to your scenario, the best solution at present is to create two release pipelines to deploy separately, because Artifact A and Artifact B have no dependencies.

In the Continuous deployment trigger of the build artifact, you can set Build branch filters to include the dev and hotfix branches.

enter image description here

Then enable Artifact filters in the Pre-deployment conditions of the stage to set the build branch artifact conditions that trigger the deployment.

Artifact filters: Select artifact condition(s) to trigger a new deployment. A release will be deployed to this stage only if all artifact conditions match.

enter image description here