Nambukarthy Raveendran
Nambukarthy Raveendran

Reputation: 116

How to get the value of $(Build.SourceVersionMessage) variable in Release Pipeline?

In the Release Pipeline under Release Notes, I am passing $(Build.SourceVersionMessage) but in my app center I am getting "$(Build.SourceVersionMessage)" as a string instead of the actual value. This variable works in my build pipeline under -task. How can I use this variable or any alternative way to fetch the commit message in the Release pipeline.

Upvotes: 1

Views: 973

Answers (1)

Leo Liu
Leo Liu

Reputation: 76958

How to get the value of $(Build.SourceVersionMessage) variable in Release Pipeline?

As we know the value of predefined variable $(Build.SourceVersionMessage) is the build pipeline, we could not get it from release pipeline directly.

To resolve this issue, there are three ways to do it:

  1. Just as GeralexGR comment, writing $(Build.SourceVersionMessage) on a text file and publish this text file as artifact and parse the value in the release pipeline.

  2. Using the REST API Definitions - Update to update the variable with the value of $(Build.SourceVersionMessage) in the build pipeline. Or using az pipelines variable-group variable to update the referenced variable group.

    You could check my previous thread for some more details.

  3. You could combine your classic release pipeline and build YAML pipeline to one pipeline with multiple stages, then we could use output variables from tasks:

     dependencies.JOB.outputs['TASK.VARIABLE']
    

Upvotes: 2

Related Questions