Thursday, 11 April 2019

Setting a Release Variable to Make It Available to Other Stages in Azure DevOps Release Pipeline

You can easily set a variable in a build or release pipeline by executing “##vso[task.setvariable variable=variablename;]variablevalue” . This sets the variable for the scope of a given stage in a release pipeline. However, it does not allow you to set a variable in the scope of a release. That means if you want to set a variable value in stage and then use it in subsequent stages it is not possible to do it with  ##vso[task.setvariable . Let’s look at achieving this need using Azure DevOps REST API.
The script available here can be used for this purpose. A slightly modified version of the script to support release pipeline and enable sending any variable name and value for updating a value of a given variable can be found here.

Popular Posts