Azure DevOps Release pipeline with multiple artifacts and stages

3k views Asked by At

Is it possible to have a single release pipeline with multiple artifacts that will trigger separate stages conditionally.

Example:

BuildPipelineA builds /PathA from AppRepo, Dev branch and publishes the artifact ArtifactA. ArtifactA should be deployed to stage A.

BuildPipelineB builds /PathB from AppRepo, Dev branch and publishes the artifact ArtifactB. ArtifactB should be deployed to stage B.

Both the artifacts are in one release pipeline and the problem I have is when I queue the build for BuildPipelineA, after the successful build, the release pipeline is created and ArtifactA is deployed to Stage A, Artifact B (last successful build artifact) is deployed to stage B.

Example Pipeline Image

What I am trying to achieve is, since BuildPipelineB is not triggered and no latest Artifact B is published, it should not be deployed to stage B when ArtifactA triggered the release and vice versa

2

There are 2 answers

1
Kevin Lu-MSFT On

What I am trying to achieve is, since BuildPipelineB is not triggered and no latest Artifact B is published, it should not be deployed to stage B when ArtifactA triggered the release and vice versa

Based on your description about the situation(same repo, same branch), I am afraid that there is no such built-in feature can directly meet your requirements.

For a workaround, you can set the condition in Stage -> Jobs.

You can use this variable to make judgments : RELEASE.TRIGGERINGARTIFACT.ALIAS.

It represents the artifact name that triggered the release.

Here is an example:

Release Stages:

enter image description here

Condition: eq(variables['RELEASE.TRIGGERINGARTIFACT.ALIAS'], '_PipelineA')

enter image description here

When the Pipeline A, trigger the Pipeline, it will run the agent job in Stage1 and it will skip the agent job in Stage2.

0
chris_r On

It is supported to have multiple artifacts in one CD and have only a specific artifact been deployed to one stage.

Azure Dev Ops

Here is photo, select from multiple artifacts which one you want to be included in deployment to azure resource.