2

I have three artifacts in my Azure DevOps Release pipeline with the following source aliases: _Client, _Database, _WebApp.

_Client is the primary artifact. I want to include each artifact's build number in the Release name.

I have used the following expression in "Release name format" under "Options" tab.

Release-$(rev:r) for Core Build-$(Release.Artifacts._WebApp.BuildNumber), Db Build-$(Release.Artifacts._Databaes.BuildNumber), Client Build-$(Release.Artifacts_Client.BuildNumber)

I expected it to name the release as "Release-74 for Core Build-29.0.0.69, Db Build-1.0.0.29, Client Build-2.1.0.34

Instead, it names it as "Release-74 for Core Build-$(Release.Artifacts._WebApp.BuildNumber), Db Build-$(Release.Artifacts._Database.BuildNumber), Client Build-$(Release.Artifacts._Client.BuildNumber)"

In initialize job log, it does show the artifacts and their respective build numbers as follows:

[RELEASE_ARTIFACTS__DATABASE_BUILDNUMBER] --> [1.0.0.29]
[RELEASE_ARTIFACTS__CLIENT_BUILDNUMBER] --> [2.1.0.34]
[RELEASE_ARTIFACTS__WEBAPP_BUILDNUMBER] --> [29.0.0.69]
[RELEASE_RELEASENAME] --> [Release-74 for Core Build-29.0.0.69, Db Build-1.0.0.29, Client Build-2.1.0.34]

Is it because it can't resolve the artifact build numbers while creating the pipeline or perhaps there is another way to achieve this?

Shayki Abramczyk
  • 36,824
  • 16
  • 89
  • 114
Sonny N
  • 170
  • 8

1 Answers1

1

The same behavior in my release, it looks like the Artifacts variable got their value only after the release will start, so it's impossible to put them in the release name.

As a workaround, you can add a simple command-line task that use the logging command to update the release name:

echo ##vso[release.updatereleasename]Release-$(rev:r) for Core Build-$(Release.Artifacts._WebApp.BuildNumber), Db Build-$(Release.Artifacts._Databaes.BuildNumber), Client Build-$(Release.Artifacts._Client.BuildNumber)

enter image description here

Shayki Abramczyk
  • 36,824
  • 16
  • 89
  • 114
  • It was not able to resolve $(rev:r) at this stage, but the suggestion worked like a charm. Used a variable ReleaseBuildNumbers with the expression: ```Core Build-$(Release.Artifacts._WebApp.BuildNumber), Db Build-$(Release.Artifacts._Databaes.BuildNumber), Client Build-$(Release.Artifacts._Client.BuildNumber)```. And used ```$(Release.ReleaseName) for $(ReleaseBuildNumbers)``` for rename. Thanks @shayki-abramczyk – Sonny N Oct 30 '19 at 21:24