Use Same Version For Build and Release Pipelines in Azure DevOps

In build pipeline set the desired build number format. The default is: 0.1.$(Rev:r) and will produce versions with patch increasing for every build

  • 0.1.1
  • 0.1.2
  • 0.1.3

In the release pipeline using one or more artefacts from the build pipeline the primary artefact will be used to populate the Build.X variables.

Set the ‘Release name format’ to: PRODUCTID $(Build.Buildnumber) (release $(Rev:r)). This will produce the following release numbers:

  • PRODUCTID 0.1.1 (release 1)
  • PRODUCTID 0.1.1 (release 2)
  • PRODUCTID 0.1.2 (release 1)

Edit: Instead of manually typing the product ID it could make sense to use the pipeline name. So the release name format would be ‘$(Release.DefinitionName) $(Build.Buildnumber) (release $(Rev:r))’

The release revision will increase every time the same build is deployed multiple times (usually during debugging of the release pipeline). New version of the build will reset the release counter back to 1.

This setup allows developers to easily see how builds and releases are related. For even more transparency the build version could be stamped into the assemblies being built.

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s