Azure DevOps release with multiple artifacts coming from the same branch

Viewed 1220

We have two build pipelines building from two different paths in the same repository.

BuildPipelineA builds /PathA from AppRepo and publishes the artifact ArtifactA

BuildPipelineB builds /PathB from AppRepo and publishes the artifact ArtifactB

We then have a release pipeline that uses both these artifacts to deploy the application to some WebApps.

As a branching strategy we're using a custom Gitflow Workflow. The only difference is that we have two development teams, each with their own integration branch. So basically instead of having the classic develop branch, we've got develop, develop-teamAlpha and develop-teamBeta. The triggers are set to all three branches, in addition to master, release/ and hotfix/, so that's a total of six branches that are being targeted.

What I'm trying to achieve is to have a CI/CD process in place that will always take artifacts from the matching(same) branch for the automatically triggered release creation.

For example, given a previous masterArtifactB exists:

  • A developer commits changes on master for some files in /PathA

  • BuildPipelineA triggers and builds ArtifactA from master

  • The ReleasePipeline should now create a new release using masterArtifactA and masterArtifactB

I want the same thing to happen even if the triggering artifact comes from a different branch:

  • A developer commits changes on develop for some files in /PathB

  • BuildPipelineB triggers and builds ArtifactB from develop

  • The ReleasePipeline should now create a new release using developArtifactB and (existing)developArtifactA


Try 1: So the first thing I've tried was to use $(Release.Artifacts.ArtifactA.SourceBranch) as a source branch for ArtifactB:

Release.Artifacts.webapp.SourceBranch example

This doesn't work because this variable depends on the release to already have its artifacts selected.

Try 2: My second attempt was to create a new pipeline that would combine the two artifacts, while making sure they are the latest from a specific, matching branch.

This build would be triggered by the completion of any of BuildPipelineA or BuildPipelineB. I used some API calls to get the source branch of the triggering build, and I used this to download ArtifactA and ArtifactB from the matching branch, and then publish the new, combined, ArtifactC.

Since the source repository for this "combining pipeline" is irrelevant, I chose to use a second repository where I stored my scripts that I used for the API calls.

Now by doing this, I have no control over the branch used to create a new release from the ArtifactC(combined artifact), because the sources for this artifact are always coming from the second repository's master branch. This also makes me lose all traceability offered by Azure DevOps. The following example might make things clearer:

ArtifactC

In addition, it won't integrate at all with the artifact filtering setup that we use for each different environment.


I'm very open to any suggestions.

0 Answers
Related